mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-12-25 07:29:25 -05:00
Update application_fpga_sim.v to match application_fpga.v
This commit is contained in:
parent
a330aa15ec
commit
4260e1d5ac
@ -23,20 +23,17 @@
|
|||||||
`define verbose(debug_command)
|
`define verbose(debug_command)
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
|
module application_fpga_sim (
|
||||||
module application_fpga (
|
|
||||||
input wire clk,
|
input wire clk,
|
||||||
|
|
||||||
output wire valid,
|
|
||||||
output wire [03 : 0] wstrb,
|
|
||||||
output wire [31 : 0] addr,
|
|
||||||
output wire [31 : 0] wdata,
|
|
||||||
output wire [31 : 0] rdata,
|
|
||||||
output wire ready,
|
|
||||||
|
|
||||||
output wire interface_rx,
|
output wire interface_rx,
|
||||||
input wire interface_tx,
|
input wire interface_tx,
|
||||||
|
|
||||||
|
output wire spi_ss,
|
||||||
|
output wire spi_sck,
|
||||||
|
output wire spi_mosi,
|
||||||
|
input wire spi_miso,
|
||||||
|
|
||||||
input wire touch_event,
|
input wire touch_event,
|
||||||
|
|
||||||
input wire app_gpio1,
|
input wire app_gpio1,
|
||||||
@ -59,14 +56,18 @@ module application_fpga (
|
|||||||
localparam RESERVED_PREFIX = 2'h2;
|
localparam RESERVED_PREFIX = 2'h2;
|
||||||
localparam MMIO_PREFIX = 2'h3;
|
localparam MMIO_PREFIX = 2'h3;
|
||||||
|
|
||||||
// MMIO core mem sub-prefixes.
|
// MMIO core sub-prefixes.
|
||||||
localparam TRNG_PREFIX = 6'h00;
|
localparam TRNG_PREFIX = 6'h00;
|
||||||
localparam TIMER_PREFIX = 6'h01;
|
localparam TIMER_PREFIX = 6'h01;
|
||||||
localparam UDS_PREFIX = 6'h02;
|
localparam UDS_PREFIX = 6'h02;
|
||||||
localparam UART_PREFIX = 6'h03;
|
localparam UART_PREFIX = 6'h03;
|
||||||
localparam TOUCH_SENSE_PREFIX = 6'h04;
|
localparam TOUCH_SENSE_PREFIX = 6'h04;
|
||||||
|
localparam FW_RAM_PREFIX = 6'h10;
|
||||||
localparam TK1_PREFIX = 6'h3f;
|
localparam TK1_PREFIX = 6'h3f;
|
||||||
|
|
||||||
|
// Instruction used to cause a trap.
|
||||||
|
localparam ILLEGAL_INSTRUCTION = 32'h0;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// Registers, memories with associated wires.
|
// Registers, memories with associated wires.
|
||||||
@ -83,93 +84,84 @@ module application_fpga (
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
wire reset_n;
|
wire reset_n;
|
||||||
|
|
||||||
|
/* verilator lint_off UNOPTFLAT */
|
||||||
|
wire cpu_trap;
|
||||||
wire cpu_valid;
|
wire cpu_valid;
|
||||||
wire [03 : 0] cpu_wstrb;
|
wire cpu_instr;
|
||||||
|
wire [ 3 : 0] cpu_wstrb;
|
||||||
|
/* verilator lint_off UNUSED */
|
||||||
wire [31 : 0] cpu_addr;
|
wire [31 : 0] cpu_addr;
|
||||||
wire [31 : 0] cpu_wdata;
|
wire [31 : 0] cpu_wdata;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
|
||||||
reg rom_cs;
|
reg rom_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
|
||||||
reg [11 : 0] rom_address;
|
reg [11 : 0] rom_address;
|
||||||
wire [31 : 0] rom_read_data;
|
wire [31 : 0] rom_read_data;
|
||||||
wire rom_ready;
|
wire rom_ready;
|
||||||
|
|
||||||
reg ram_cs;
|
reg ram_cs;
|
||||||
reg [ 3 : 0] ram_we;
|
reg [ 3 : 0] ram_we;
|
||||||
reg [14 : 0] ram_address;
|
reg [15 : 0] ram_address;
|
||||||
reg [31 : 0] ram_write_data;
|
reg [31 : 0] ram_write_data;
|
||||||
wire [31 : 0] ram_read_data;
|
wire [31 : 0] ram_read_data;
|
||||||
wire ram_ready;
|
wire ram_ready;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
|
||||||
reg trng_cs;
|
reg trng_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
|
||||||
reg trng_we;
|
reg trng_we;
|
||||||
reg [ 7 : 0] trng_address;
|
reg [ 7 : 0] trng_address;
|
||||||
reg [31 : 0] trng_write_data;
|
reg [31 : 0] trng_write_data;
|
||||||
wire [31 : 0] trng_read_data;
|
wire [31 : 0] trng_read_data;
|
||||||
wire trng_ready;
|
wire trng_ready;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
|
||||||
reg timer_cs;
|
reg timer_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
|
||||||
reg timer_we;
|
reg timer_we;
|
||||||
reg [ 7 : 0] timer_address;
|
reg [ 7 : 0] timer_address;
|
||||||
reg [31 : 0] timer_write_data;
|
reg [31 : 0] timer_write_data;
|
||||||
wire [31 : 0] timer_read_data;
|
wire [31 : 0] timer_read_data;
|
||||||
wire timer_ready;
|
wire timer_ready;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
|
||||||
reg uds_cs;
|
reg uds_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
reg [ 2 : 0] uds_address;
|
||||||
reg [ 7 : 0] uds_address;
|
|
||||||
wire [31 : 0] uds_read_data;
|
wire [31 : 0] uds_read_data;
|
||||||
wire uds_ready;
|
wire uds_ready;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
|
||||||
reg uart_cs;
|
reg uart_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
|
||||||
reg uart_we;
|
reg uart_we;
|
||||||
reg [ 7 : 0] uart_address;
|
reg [ 7 : 0] uart_address;
|
||||||
reg [31 : 0] uart_write_data;
|
reg [31 : 0] uart_write_data;
|
||||||
wire [31 : 0] uart_read_data;
|
wire [31 : 0] uart_read_data;
|
||||||
wire uart_ready;
|
wire uart_ready;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
reg fw_ram_cs;
|
||||||
|
reg [ 3 : 0] fw_ram_we;
|
||||||
|
reg [ 8 : 0] fw_ram_address;
|
||||||
|
reg [31 : 0] fw_ram_write_data;
|
||||||
|
wire [31 : 0] fw_ram_read_data;
|
||||||
|
wire fw_ram_ready;
|
||||||
|
|
||||||
reg touch_sense_cs;
|
reg touch_sense_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
|
||||||
reg touch_sense_we;
|
reg touch_sense_we;
|
||||||
reg [ 7 : 0] touch_sense_address;
|
reg [ 7 : 0] touch_sense_address;
|
||||||
wire [31 : 0] touch_sense_read_data;
|
wire [31 : 0] touch_sense_read_data;
|
||||||
wire touch_sense_ready;
|
wire touch_sense_ready;
|
||||||
|
|
||||||
/* verilator lint_off UNOPTFLAT */
|
|
||||||
reg tk1_cs;
|
reg tk1_cs;
|
||||||
/* verilator lint_on UNOPTFLAT */
|
|
||||||
reg tk1_we;
|
reg tk1_we;
|
||||||
reg [ 7 : 0] tk1_address;
|
reg [ 7 : 0] tk1_address;
|
||||||
reg [31 : 0] tk1_write_data;
|
reg [31 : 0] tk1_write_data;
|
||||||
wire [31 : 0] tk1_read_data;
|
wire [31 : 0] tk1_read_data;
|
||||||
wire tk1_ready;
|
wire tk1_ready;
|
||||||
wire system_mode;
|
wire system_mode;
|
||||||
|
wire force_trap;
|
||||||
|
wire [14 : 0] ram_addr_rand;
|
||||||
//----------------------------------------------------------------
|
wire [31 : 0] ram_data_rand;
|
||||||
// Concurrent assignments.
|
wire tk1_system_reset;
|
||||||
//----------------------------------------------------------------
|
/* verilator lint_on UNOPTFLAT */
|
||||||
assign valid = cpu_valid;
|
|
||||||
assign wstrb = cpu_wstrb;
|
|
||||||
assign addr = cpu_addr;
|
|
||||||
assign wdata = cpu_wdata;
|
|
||||||
assign rdata = muxed_rdata_reg;
|
|
||||||
assign ready = muxed_ready_reg;
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// Module instantiations.
|
// Module instantiations.
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
reset_gen #(
|
reset_gen_sim #(
|
||||||
.RESET_CYCLES(200)
|
.RESET_CYCLES(200)
|
||||||
) reset_gen_inst (
|
) reset_gen_inst (
|
||||||
.clk (clk),
|
.clk (clk),
|
||||||
@ -179,35 +171,31 @@ module application_fpga (
|
|||||||
|
|
||||||
picorv32 #(
|
picorv32 #(
|
||||||
.ENABLE_COUNTERS(0),
|
.ENABLE_COUNTERS(0),
|
||||||
.LATCHED_MEM_RDATA(0),
|
|
||||||
.TWO_STAGE_SHIFT(0),
|
.TWO_STAGE_SHIFT(0),
|
||||||
.TWO_CYCLE_ALU(0),
|
.CATCH_MISALIGN (0),
|
||||||
.CATCH_MISALIGN(0),
|
.COMPRESSED_ISA (1),
|
||||||
.CATCH_ILLINSN(0),
|
.ENABLE_FAST_MUL(1),
|
||||||
.COMPRESSED_ISA(1),
|
.BARREL_SHIFTER (1)
|
||||||
.ENABLE_MUL(1),
|
|
||||||
.ENABLE_DIV(0),
|
|
||||||
.BARREL_SHIFTER(0)
|
|
||||||
) cpu (
|
) cpu (
|
||||||
.clk(clk),
|
.clk(clk),
|
||||||
.resetn(reset_n),
|
.resetn(reset_n),
|
||||||
|
.trap(cpu_trap),
|
||||||
|
|
||||||
.mem_valid(cpu_valid),
|
.mem_valid(cpu_valid),
|
||||||
|
.mem_ready(muxed_ready_reg),
|
||||||
.mem_addr (cpu_addr),
|
.mem_addr (cpu_addr),
|
||||||
.mem_wdata(cpu_wdata),
|
.mem_wdata(cpu_wdata),
|
||||||
.mem_wstrb(cpu_wstrb),
|
.mem_wstrb(cpu_wstrb),
|
||||||
.mem_rdata(muxed_rdata_reg),
|
.mem_rdata(muxed_rdata_reg),
|
||||||
.mem_ready(muxed_ready_reg),
|
.mem_instr(cpu_instr),
|
||||||
|
|
||||||
// Defined unsed ports. Makes lint happy,
|
// Defined unused ports. Makes lint happy. But
|
||||||
// but still needs to help lint with empty ports.
|
// we still needs to help lint with empty ports.
|
||||||
/* verilator lint_off PINCONNECTEMPTY */
|
/* verilator lint_off PINCONNECTEMPTY */
|
||||||
.irq(32'h0),
|
.irq(32'h0),
|
||||||
.eoi(),
|
.eoi(),
|
||||||
.trap(),
|
|
||||||
.trace_valid(),
|
.trace_valid(),
|
||||||
.trace_data(),
|
.trace_data(),
|
||||||
.mem_instr(),
|
|
||||||
.mem_la_read(),
|
.mem_la_read(),
|
||||||
.mem_la_write(),
|
.mem_la_write(),
|
||||||
.mem_la_addr(),
|
.mem_la_addr(),
|
||||||
@ -226,6 +214,9 @@ module application_fpga (
|
|||||||
|
|
||||||
|
|
||||||
rom rom_inst (
|
rom rom_inst (
|
||||||
|
.clk(clk),
|
||||||
|
.reset_n(reset_n),
|
||||||
|
|
||||||
.cs(rom_cs),
|
.cs(rom_cs),
|
||||||
.address(rom_address),
|
.address(rom_address),
|
||||||
.read_data(rom_read_data),
|
.read_data(rom_read_data),
|
||||||
@ -237,6 +228,9 @@ module application_fpga (
|
|||||||
.clk(clk),
|
.clk(clk),
|
||||||
.reset_n(reset_n),
|
.reset_n(reset_n),
|
||||||
|
|
||||||
|
.ram_addr_rand(ram_addr_rand),
|
||||||
|
.ram_data_rand(ram_data_rand),
|
||||||
|
|
||||||
.cs(ram_cs),
|
.cs(ram_cs),
|
||||||
.we(ram_we),
|
.we(ram_we),
|
||||||
.address(ram_address),
|
.address(ram_address),
|
||||||
@ -246,6 +240,33 @@ module application_fpga (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
fw_ram fw_ram_inst (
|
||||||
|
.clk(clk),
|
||||||
|
.reset_n(reset_n),
|
||||||
|
|
||||||
|
.system_mode(system_mode),
|
||||||
|
|
||||||
|
.cs(fw_ram_cs),
|
||||||
|
.we(fw_ram_we),
|
||||||
|
.address(fw_ram_address),
|
||||||
|
.write_data(fw_ram_write_data),
|
||||||
|
.read_data(fw_ram_read_data),
|
||||||
|
.ready(fw_ram_ready)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
trng_sim trng_inst (
|
||||||
|
.clk(clk),
|
||||||
|
.reset_n(reset_n),
|
||||||
|
.cs(trng_cs),
|
||||||
|
.we(trng_we),
|
||||||
|
.address(trng_address),
|
||||||
|
.write_data(trng_write_data),
|
||||||
|
.read_data(trng_read_data),
|
||||||
|
.ready(trng_ready)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
timer timer_inst (
|
timer timer_inst (
|
||||||
.clk(clk),
|
.clk(clk),
|
||||||
.reset_n(reset_n),
|
.reset_n(reset_n),
|
||||||
@ -263,6 +284,8 @@ module application_fpga (
|
|||||||
.clk(clk),
|
.clk(clk),
|
||||||
.reset_n(reset_n),
|
.reset_n(reset_n),
|
||||||
|
|
||||||
|
.system_mode(system_mode),
|
||||||
|
|
||||||
.cs(uds_cs),
|
.cs(uds_cs),
|
||||||
.address(uds_address),
|
.address(uds_address),
|
||||||
.read_data(uds_read_data),
|
.read_data(uds_read_data),
|
||||||
@ -300,12 +323,30 @@ module application_fpga (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
tk1 tk1_inst (
|
tk1 #(
|
||||||
|
.APP_SIZE(`APP_SIZE)
|
||||||
|
) tk1_inst (
|
||||||
.clk(clk),
|
.clk(clk),
|
||||||
.reset_n(reset_n),
|
.reset_n(reset_n),
|
||||||
|
|
||||||
.system_mode(system_mode),
|
.system_mode(system_mode),
|
||||||
|
|
||||||
|
.cpu_addr (cpu_addr),
|
||||||
|
.cpu_instr (cpu_instr),
|
||||||
|
.cpu_valid (cpu_valid),
|
||||||
|
.cpu_trap (cpu_trap),
|
||||||
|
.force_trap(force_trap),
|
||||||
|
|
||||||
|
.system_reset(tk1_system_reset),
|
||||||
|
|
||||||
|
.ram_addr_rand(ram_addr_rand),
|
||||||
|
.ram_data_rand(ram_data_rand),
|
||||||
|
|
||||||
|
.spi_ss (spi_ss),
|
||||||
|
.spi_sck (spi_sck),
|
||||||
|
.spi_mosi(spi_mosi),
|
||||||
|
.spi_miso(spi_miso),
|
||||||
|
|
||||||
.led_r(led_r),
|
.led_r(led_r),
|
||||||
.led_g(led_g),
|
.led_g(led_g),
|
||||||
.led_b(led_b),
|
.led_b(led_b),
|
||||||
@ -330,13 +371,12 @@ module application_fpga (
|
|||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
always @(posedge clk) begin : reg_update
|
always @(posedge clk) begin : reg_update
|
||||||
if (!reset_n) begin
|
if (!reset_n) begin
|
||||||
muxed_ready_reg <= 1'h0;
|
|
||||||
muxed_rdata_reg <= 32'h0;
|
muxed_rdata_reg <= 32'h0;
|
||||||
|
muxed_ready_reg <= 1'h0;
|
||||||
end
|
end
|
||||||
|
|
||||||
else begin
|
else begin
|
||||||
muxed_ready_reg <= muxed_ready_new;
|
|
||||||
muxed_rdata_reg <= muxed_rdata_new;
|
muxed_rdata_reg <= muxed_rdata_new;
|
||||||
|
muxed_ready_reg <= muxed_ready_new;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -348,7 +388,9 @@ module application_fpga (
|
|||||||
always @* begin : cpu_mem_ctrl
|
always @* begin : cpu_mem_ctrl
|
||||||
reg [1 : 0] area_prefix;
|
reg [1 : 0] area_prefix;
|
||||||
reg [5 : 0] core_prefix;
|
reg [5 : 0] core_prefix;
|
||||||
|
reg [255:0] ascii_state;
|
||||||
|
|
||||||
|
ascii_state = "";
|
||||||
area_prefix = cpu_addr[31 : 30];
|
area_prefix = cpu_addr[31 : 30];
|
||||||
core_prefix = cpu_addr[29 : 24];
|
core_prefix = cpu_addr[29 : 24];
|
||||||
|
|
||||||
@ -359,10 +401,15 @@ module application_fpga (
|
|||||||
rom_address = cpu_addr[13 : 2];
|
rom_address = cpu_addr[13 : 2];
|
||||||
|
|
||||||
ram_cs = 1'h0;
|
ram_cs = 1'h0;
|
||||||
ram_we = cpu_wstrb;
|
ram_we = 4'h0;
|
||||||
ram_address = cpu_addr[16 : 2];
|
ram_address = cpu_addr[17 : 2];
|
||||||
ram_write_data = cpu_wdata;
|
ram_write_data = cpu_wdata;
|
||||||
|
|
||||||
|
fw_ram_cs = 1'h0;
|
||||||
|
fw_ram_we = cpu_wstrb;
|
||||||
|
fw_ram_address = cpu_addr[10 : 2];
|
||||||
|
fw_ram_write_data = cpu_wdata;
|
||||||
|
|
||||||
trng_cs = 1'h0;
|
trng_cs = 1'h0;
|
||||||
trng_we = |cpu_wstrb;
|
trng_we = |cpu_wstrb;
|
||||||
trng_address = cpu_addr[9 : 2];
|
trng_address = cpu_addr[9 : 2];
|
||||||
@ -374,7 +421,7 @@ module application_fpga (
|
|||||||
timer_write_data = cpu_wdata;
|
timer_write_data = cpu_wdata;
|
||||||
|
|
||||||
uds_cs = 1'h0;
|
uds_cs = 1'h0;
|
||||||
uds_address = cpu_addr[9 : 2];
|
uds_address = cpu_addr[4 : 2];
|
||||||
|
|
||||||
uart_cs = 1'h0;
|
uart_cs = 1'h0;
|
||||||
uart_we = |cpu_wstrb;
|
uart_we = |cpu_wstrb;
|
||||||
@ -390,92 +437,123 @@ module application_fpga (
|
|||||||
tk1_address = cpu_addr[9 : 2];
|
tk1_address = cpu_addr[9 : 2];
|
||||||
tk1_write_data = cpu_wdata;
|
tk1_write_data = cpu_wdata;
|
||||||
|
|
||||||
|
// Two stage mux implementing read and
|
||||||
|
// write access performed based on the address
|
||||||
|
// from the CPU.
|
||||||
if (cpu_valid && !muxed_ready_reg) begin
|
if (cpu_valid && !muxed_ready_reg) begin
|
||||||
case (area_prefix)
|
if (force_trap) begin
|
||||||
ROM_PREFIX: begin
|
`verbose($display("Force trap");)
|
||||||
`verbose($display("Access to ROM area");)
|
ascii_state = "Force trap";
|
||||||
rom_cs = 1'h1;
|
muxed_rdata_new = ILLEGAL_INSTRUCTION;
|
||||||
muxed_rdata_new = rom_read_data;
|
muxed_ready_new = 1'h1;
|
||||||
muxed_ready_new = rom_ready;
|
end
|
||||||
end
|
else begin
|
||||||
|
case (area_prefix)
|
||||||
|
ROM_PREFIX: begin
|
||||||
|
`verbose($display("Access to ROM area");)
|
||||||
|
ascii_state = "ROM area";
|
||||||
|
rom_cs = 1'h1;
|
||||||
|
muxed_rdata_new = rom_read_data;
|
||||||
|
muxed_ready_new = rom_ready;
|
||||||
|
end
|
||||||
|
|
||||||
RAM_PREFIX: begin
|
RAM_PREFIX: begin
|
||||||
`verbose($display("Access to RAM area");)
|
`verbose($display("Access to RAM area");)
|
||||||
ram_cs = 1'h1;
|
ascii_state = "RAM area";
|
||||||
muxed_rdata_new = ram_read_data;
|
ram_cs = 1'h1;
|
||||||
muxed_ready_new = ram_ready;
|
ram_we = cpu_wstrb;
|
||||||
end
|
muxed_rdata_new = ram_read_data;
|
||||||
|
muxed_ready_new = ram_ready;
|
||||||
|
end
|
||||||
|
|
||||||
RESERVED_PREFIX: begin
|
RESERVED_PREFIX: begin
|
||||||
`verbose($display("Access to RESERVED area");)
|
`verbose($display("Access to RESERVED area");)
|
||||||
muxed_rdata_new = 32'h00000000;
|
ascii_state = "RESERVED area";
|
||||||
muxed_ready_new = 1'h1;
|
muxed_rdata_new = 32'h0;
|
||||||
end
|
muxed_ready_new = 1'h1;
|
||||||
|
end
|
||||||
|
|
||||||
MMIO_PREFIX: begin
|
MMIO_PREFIX: begin
|
||||||
`verbose($display("Access to MMIO area");)
|
`verbose($display("Access to MMIO area");)
|
||||||
case (core_prefix)
|
case (core_prefix)
|
||||||
TRNG_PREFIX: begin
|
TRNG_PREFIX: begin
|
||||||
`verbose($display("Access to TRNG core");)
|
`verbose($display("Access to TRNG core");)
|
||||||
trng_cs = 1'h1;
|
ascii_state = "TRNG core";
|
||||||
muxed_rdata_new = trng_read_data;
|
trng_cs = 1'h1;
|
||||||
muxed_ready_new = trng_ready;
|
muxed_rdata_new = trng_read_data;
|
||||||
end
|
muxed_ready_new = trng_ready;
|
||||||
|
end
|
||||||
|
|
||||||
TIMER_PREFIX: begin
|
TIMER_PREFIX: begin
|
||||||
`verbose($display("Access to TIMER core");)
|
`verbose($display("Access to TIMER core");)
|
||||||
timer_cs = 1'h1;
|
ascii_state = "TIMER core";
|
||||||
muxed_rdata_new = timer_read_data;
|
timer_cs = 1'h1;
|
||||||
muxed_ready_new = timer_ready;
|
muxed_rdata_new = timer_read_data;
|
||||||
end
|
muxed_ready_new = timer_ready;
|
||||||
|
end
|
||||||
|
|
||||||
UDS_PREFIX: begin
|
UDS_PREFIX: begin
|
||||||
`verbose($display("Access to UDS core");)
|
`verbose($display("Access to UDS core");)
|
||||||
uds_cs = 1'h1;
|
ascii_state = "UDS core";
|
||||||
muxed_rdata_new = uds_read_data;
|
uds_cs = 1'h1;
|
||||||
muxed_ready_new = uds_ready;
|
muxed_rdata_new = uds_read_data;
|
||||||
end
|
muxed_ready_new = uds_ready;
|
||||||
|
end
|
||||||
|
|
||||||
UART_PREFIX: begin
|
UART_PREFIX: begin
|
||||||
`verbose($display("Access to UART core");)
|
`verbose($display("Access to UART core");)
|
||||||
uart_cs = 1'h1;
|
ascii_state = "UART core";
|
||||||
muxed_rdata_new = uart_read_data;
|
uart_cs = 1'h1;
|
||||||
muxed_ready_new = uart_ready;
|
muxed_rdata_new = uart_read_data;
|
||||||
end
|
muxed_ready_new = uart_ready;
|
||||||
|
end
|
||||||
|
|
||||||
TOUCH_SENSE_PREFIX: begin
|
TOUCH_SENSE_PREFIX: begin
|
||||||
`verbose($display("Access to TOUCH_SENSE core");)
|
`verbose($display("Access to TOUCH_SENSE core");)
|
||||||
touch_sense_cs = 1'h1;
|
ascii_state = "TOUCH_SENSE core";
|
||||||
muxed_rdata_new = touch_sense_read_data;
|
touch_sense_cs = 1'h1;
|
||||||
muxed_ready_new = touch_sense_ready;
|
muxed_rdata_new = touch_sense_read_data;
|
||||||
end
|
muxed_ready_new = touch_sense_ready;
|
||||||
|
end
|
||||||
|
|
||||||
TK1_PREFIX: begin
|
FW_RAM_PREFIX: begin
|
||||||
`verbose($display("Access to TK1 core");)
|
`verbose($display("Access to FW_RAM core");)
|
||||||
tk1_cs = 1'h1;
|
ascii_state = "FW_RAM core";
|
||||||
muxed_rdata_new = tk1_read_data;
|
fw_ram_cs = 1'h1;
|
||||||
muxed_ready_new = tk1_ready;
|
muxed_rdata_new = fw_ram_read_data;
|
||||||
end
|
muxed_ready_new = fw_ram_ready;
|
||||||
|
end
|
||||||
|
|
||||||
default: begin
|
TK1_PREFIX: begin
|
||||||
`verbose($display("UNDEFINED MMIO");)
|
`verbose($display("Access to TK1 core");)
|
||||||
muxed_rdata_new = 32'h00000000;
|
ascii_state = "TK1 core";
|
||||||
muxed_ready_new = 1'h1;
|
tk1_cs = 1'h1;
|
||||||
end
|
muxed_rdata_new = tk1_read_data;
|
||||||
endcase // case (core_prefix)
|
muxed_ready_new = tk1_ready;
|
||||||
end // case: MMIO_PREFIX
|
end
|
||||||
|
|
||||||
default: begin
|
default: begin
|
||||||
`verbose($display("UNDEFINED AREA");)
|
`verbose($display("UNDEFINED MMIO");)
|
||||||
muxed_rdata_new = 32'h0;
|
ascii_state = "UNDEFINED MMIO";
|
||||||
muxed_ready_new = 1'h1;
|
muxed_rdata_new = 32'h0;
|
||||||
end
|
muxed_ready_new = 1'h1;
|
||||||
endcase // case (area_prefix)
|
end
|
||||||
end
|
endcase // case (core_prefix)
|
||||||
|
end // case: MMIO_PREFIX
|
||||||
|
|
||||||
|
default: begin
|
||||||
|
`verbose($display("UNDEFINED AREA");)
|
||||||
|
ascii_state = "UNDEFINED AREA";
|
||||||
|
muxed_rdata_new = 32'h0;
|
||||||
|
muxed_ready_new = 1'h1;
|
||||||
|
end
|
||||||
|
endcase // case (area_prefix)
|
||||||
|
end // if (force_trap) begin end else begin
|
||||||
|
end // if (cpu_valid && !muxed_ready_reg) begin
|
||||||
end
|
end
|
||||||
|
|
||||||
endmodule // application_fpga
|
endmodule // application_fpga
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// EOF application_fpga.v
|
// EOF application_fpga_sim.v
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user