diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-05-05 17:38:55 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-05-05 18:12:08 -0600 |
| commit | ca02833f22b08ceeeff501107371aa6667426115 (patch) | |
| tree | f864c5fc238a292082d2096ce546270badce9f1d /rtl/gfx/gfx_bootrom.sv | |
| parent | 081a8a3ba8bfe036f31da53f9c041a2caa30fce2 (diff) | |
rtl/gfx: rename platform/wavelet3d -> rtl/gfx
Diffstat (limited to 'rtl/gfx/gfx_bootrom.sv')
| -rw-r--r-- | rtl/gfx/gfx_bootrom.sv | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/rtl/gfx/gfx_bootrom.sv b/rtl/gfx/gfx_bootrom.sv new file mode 100644 index 0000000..2c4581e --- /dev/null +++ b/rtl/gfx/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 |
