summaryrefslogtreecommitdiff
path: root/platform/wavelet3d/gfx_bootrom.sv
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-05-03 12:01:36 -0600
committerAlejandro Soto <alejandro@34project.org>2024-05-03 12:01:36 -0600
commitd6dcfc10f26056485cb260af93027047a6aa8d30 (patch)
tree358a7e69c13fe51f7348bba893c2489db9b022fc /platform/wavelet3d/gfx_bootrom.sv
parent405c0287c80c34b0e9dfb9d9326b86d12433b4c4 (diff)
platform/wavelet3d: implement sched domain crossbar
Diffstat (limited to '')
-rw-r--r--platform/wavelet3d/gfx_bootrom.sv66
1 files changed, 66 insertions, 0 deletions
diff --git a/platform/wavelet3d/gfx_bootrom.sv b/platform/wavelet3d/gfx_bootrom.sv
new file mode 100644
index 0000000..2c4581e
--- /dev/null
+++ b/platform/wavelet3d/gfx_bootrom.sv
@@ -0,0 +1,66 @@
+module gfx_bootrom
+import gfx::*;
+(
+ input logic clk,
+ rst_n,
+
+ gfx_axil.s axis
+);
+
+ localparam ROM_WORDS_LOG = 8;
+
+ enum int unsigned
+ {
+ WAIT,
+ READ,
+ RDATA,
+ READY
+ } state;
+
+ word read, rom[1 << ROM_WORDS_LOG];
+ logic[ROM_WORDS_LOG - 1:0] read_addr;
+
+ assign axis.bvalid = 0;
+ assign axis.wready = 0;
+ assign axis.awready = 0;
+
+ always_ff @(posedge clk or negedge rst_n)
+ if (~rst_n) begin
+ state <= WAIT;
+ axis.rvalid <= 0;
+ axis.arready <= 0;
+ end else begin
+ axis.arready <= 0;
+
+ unique case (state)
+ WAIT:
+ if (axis.arvalid & ~axis.arready)
+ state <= READ;
+
+ READ:
+ state <= RDATA;
+
+ RDATA: begin
+ state <= READY;
+ axis.rvalid <= 1;
+ end
+
+ READY:
+ if (axis.rready) begin
+ state <= WAIT;
+ axis.rvalid <= 0;
+ axis.arready <= 1;
+ end
+ endcase
+ end
+
+ always_ff @(posedge clk) begin
+ read <= rom[read_addr];
+ read_addr <= axis.araddr[$bits(read_addr) + SUBWORD_BITS - 1:SUBWORD_BITS];
+ axis.rdata <= read;
+ end
+
+ initial
+ $readmemh("gfx_bootrom.hex", rom);
+
+endmodule