diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-11-17 20:22:02 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-11-17 20:22:02 -0600 |
| commit | e573ddb5814ac1c9cafd6376c3052ca01dddeae8 (patch) | |
| tree | c8f89ebb19f99fff123ed634d9d3c0f951641d58 /rtl/gfx | |
| parent | 7275f342f2b8d97ae02e0e51011442f063660b5d (diff) | |
tb: add test: fifo
Diffstat (limited to 'rtl/gfx')
| -rw-r--r-- | rtl/gfx/gfx_fifo.sv | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/rtl/gfx/gfx_fifo.sv b/rtl/gfx/gfx_fifo.sv index 7314b4b..e9fa8f5 100644 --- a/rtl/gfx/gfx_fifo.sv +++ b/rtl/gfx/gfx_fifo.sv @@ -13,10 +13,15 @@ module gfx_fifo output logic[WIDTH - 1:0] out ); - logic full_if_eq, in_stall, out_stall, may_read, may_write, read, read_ok, write; + logic do_read, do_write, full_if_eq, in_stall, out_stall, + may_read, may_write, read, read_ok, write; + logic[WIDTH - 1:0] fifo[DEPTH], read_data, write_data; logic[$clog2(DEPTH) - 1:0] read_ptr, write_ptr; + assign do_read = read && may_read; + assign do_write = write && may_write; + always_comb begin may_read = full_if_eq; may_write = !full_if_eq; @@ -70,15 +75,15 @@ module gfx_fifo if (!out_stall) read_ok <= read && may_read; - if (read && may_read) + if (do_read) read_ptr <= read_ptr + 1; - if (write && may_write) + if (do_write) write_ptr <= write_ptr + 1; - if (read && !write) + if (do_read && !do_write) full_if_eq <= 0; - else if (!read && write) + else if (!do_read && do_write) full_if_eq <= 1; end |
