diff --git a/libraries/base/reorder/src/vhdl/reorder_sequencer.vhd b/libraries/base/reorder/src/vhdl/reorder_sequencer.vhd index 233ab3de4804e9d7ff403471d48974de861ae3c0..e45602e12d713a4bed306731b18a6366833ee0e2 100644 --- a/libraries/base/reorder/src/vhdl/reorder_sequencer.vhd +++ b/libraries/base/reorder/src/vhdl/reorder_sequencer.vhd @@ -33,6 +33,7 @@ -- - wr_nof_chunks is the number of write accesses performed during a write period -- - rd_chunksize is the number of samples that are read during a read access. -- - rd_nof_chunks is the number of read accesses performed during a read period +-- - rd_interval defines the number of blocks in between two consecutive reads. -- - gapsize is the address space to be skipped in between two consecutive write or -- read periods. Gapsize can be used to create byte-alignment in the memory. -- - nof_blocks determines the number of write and read periods before the page @@ -43,7 +44,8 @@ -- wr_chunksize : POSITIVE := 8 -- wr_nof_chunks : POSITIVE := 1; -- rd_chunksize : POSITIVE := 4; --- rd_nof_chunks : POSITIVE := 2; +-- rd_nof_chunks : POSITIVE := 2; +-- rd_interval : POSITIVE := 2; -- gapsize : NATURAL := 0; -- nof_blocks : POSITIVE := 5; @@ -55,27 +57,27 @@ -- -------- -------- -- gapsize | | | | -- -------- -------- --- |1 | |0,1 | +-- |1 | |1,1 | -- | | -------- --- | | |3,0 | +-- | | |4,0 | -- -------- -------- -- | | | | -- -------- -------- --- |2 | |1,0 | +-- |2 | |0,1 | -- | | -------- --- | | |3,1 | +-- | | |3,0 | -- -------- -------- -- | | | | -- -------- -------- --- |3 | |1,1 | +-- |3 | |2,0 | -- | | -------- --- | | |4,0 | +-- | | |4,1 | -- -------- -------- -- | | | | -- -------- -------- --- |4 | |2,0 | +-- |4 | |1,0 | -- | | -------- --- | | |4,1 | +-- | | |3,1 | -- -------- -------- -- | | | | -- -------- -------- @@ -117,11 +119,12 @@ END reorder_sequencer; ARCHITECTURE rtl OF reorder_sequencer IS - CONSTANT c_blocksize : POSITIVE := g_reorder_seq.wr_nof_chunks * (g_reorder_seq.wr_chunksize + g_reorder_seq.gapsize); - CONSTANT c_page_size : POSITIVE := c_blocksize * g_reorder_seq.nof_blocks; - CONSTANT c_nof_wr_access : POSITIVE := g_reorder_seq.wr_nof_chunks * g_reorder_seq.nof_blocks; - CONSTANT c_address_w : POSITIVE := ceil_log2(2*c_page_size); - CONSTANT c_address_shift_w : POSITIVE := ceil_log2(g_data_w_ratio); + CONSTANT c_blocksize : POSITIVE := g_reorder_seq.wr_nof_chunks * (g_reorder_seq.wr_chunksize + g_reorder_seq.gapsize); + CONSTANT c_page_size : POSITIVE := c_blocksize * g_reorder_seq.nof_blocks; + CONSTANT c_rd_block_increment : POSITIVE := c_blocksize * g_reorder_seq.rd_interval; + CONSTANT c_nof_wr_access : POSITIVE := g_reorder_seq.wr_nof_chunks * g_reorder_seq.nof_blocks; + CONSTANT c_address_w : POSITIVE := ceil_log2(2*c_page_size); + CONSTANT c_address_shift_w : POSITIVE := ceil_log2(g_data_w_ratio); TYPE state_type is (s_idle, s_write, s_first_write, s_wait_wr, s_read, s_wait_rd); @@ -224,36 +227,32 @@ BEGIN END IF; WHEN s_wait_rd => + + v.rd_block_offset := (r.rd_block_offset + c_rd_block_increment) MOD c_page_size; + + IF(r.rd_block_offset + c_rd_block_increment >= c_page_size) THEN + v.rd_chunks_offset := r.rd_chunks_offset + g_reorder_seq.rd_chunksize; + v.rd_chunks_cnt := r.rd_chunks_cnt + 1; + ELSE + v.rd_block_cnt := r.rd_block_cnt + 1; + END IF; + IF(r.switch_cnt = g_reorder_seq.rd_nof_chunks) THEN v.switch_cnt := 0; v.state := s_write; - ELSE - v.state := s_read; - END IF; - - IF(r.rd_block_cnt = g_reorder_seq.nof_blocks-1 AND r.rd_chunks_cnt = g_reorder_seq.rd_nof_chunks-1) THEN - v.rd_block_offset := 0; - v.rd_chunks_offset := 0; - v.rd_block_cnt := 0; - v.rd_chunks_cnt := 0; IF(r.page_cnt = c_nof_wr_access) THEN v.rd_page_offset := r.wr_page_offset; v.wr_page_offset := r.rd_page_offset; v.page_cnt := 0; v.first_write := '0'; --- IF(sync_ok_in = '0') THEN --- v.state := s_idle; --- END IF; + v.rd_block_offset := 0; + v.rd_chunks_offset := 0; + v.rd_block_cnt := 0; + v.rd_chunks_cnt := 0; END IF; - ELSIF(r.rd_block_cnt = g_reorder_seq.nof_blocks-1) THEN - v.rd_block_offset := 0; - v.rd_chunks_offset := r.rd_chunks_offset + g_reorder_seq.rd_chunksize; - v.rd_block_cnt := 0; - v.rd_chunks_cnt := r.rd_chunks_cnt + 1; - ELSE - v.rd_block_offset := r.rd_block_offset + c_blocksize; - v.rd_block_cnt := r.rd_block_cnt + 1; - END IF; + ELSE + v.state := s_read; + END IF; WHEN OTHERS => v.state := s_idle;