Skip to content
Snippets Groups Projects
Commit 6ca43322 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Only need to reset the state reg, do not reset the other signals to easy...

Only need to reset the state reg, do not reset the other signals to easy timing closure. Use natural for burst_wr_cnt instead of slv.
parent 22d96617
No related branches found
No related tags found
No related merge requests found
...@@ -82,17 +82,17 @@ ARCHITECTURE str OF io_ddr_driver IS ...@@ -82,17 +82,17 @@ ARCHITECTURE str OF io_ddr_driver IS
SIGNAL dvr_wr_not_rd : STD_LOGIC; SIGNAL dvr_wr_not_rd : STD_LOGIC;
SIGNAL dvr_start_address : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0); SIGNAL dvr_start_address : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0);
SIGNAL dvr_nof_data : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0); SIGNAL dvr_nof_data : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0);
SIGNAL dvr_done : STD_LOGIC; SIGNAL dvr_done : STD_LOGIC := '0';
SIGNAL nxt_dvr_done : STD_LOGIC; SIGNAL nxt_dvr_done : STD_LOGIC;
SIGNAL burst_size : POSITIVE RANGE 1 TO 2**g_tech_ddr.maxburstsize_w-1; -- burst size >= 1 SIGNAL burst_size : POSITIVE RANGE 1 TO 2**g_tech_ddr.maxburstsize_w-1 := 1; -- burst size >= 1
SIGNAL nxt_burst_size : POSITIVE; SIGNAL nxt_burst_size : POSITIVE;
SIGNAL burst_wr_cnt : STD_LOGIC_VECTOR(g_tech_ddr.maxburstsize_w-1 DOWNTO 0); -- count down from burst_size to 0 SIGNAL burst_wr_cnt : NATURAL RANGE 0 TO 2**g_tech_ddr.maxburstsize_w-1 := 0; -- count down from burst_size to 0
SIGNAL nxt_burst_wr_cnt : STD_LOGIC_VECTOR(g_tech_ddr.maxburstsize_w-1 DOWNTO 0); SIGNAL nxt_burst_wr_cnt : NATURAL RANGE 0 TO 2**g_tech_ddr.maxburstsize_w-1;
SIGNAL cur_address : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0); SIGNAL cur_address : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0) := (OTHERS=>'0');
SIGNAL nxt_cur_address : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0); SIGNAL nxt_cur_address : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0);
SIGNAL address_cnt : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0); -- count down nof addresses = nof ctlr data words SIGNAL address_cnt : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0) := (OTHERS=>'0'); -- count down nof addresses = nof ctlr data words
SIGNAL nxt_address_cnt : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0); SIGNAL nxt_address_cnt : STD_LOGIC_VECTOR(c_ctlr_address_w-1 DOWNTO 0);
BEGIN BEGIN
...@@ -108,20 +108,15 @@ BEGIN ...@@ -108,20 +108,15 @@ BEGIN
BEGIN BEGIN
IF rst='1' THEN IF rst='1' THEN
state <= s_init; state <= s_init;
burst_wr_cnt <= (OTHERS=>'0'); prev_state <= s_init;
dvr_done <= '0';
cur_address <= (OTHERS=>'0');
address_cnt <= (OTHERS=>'0');
burst_size <= 1;
prev_state <= s_idle;
ELSIF rising_edge(clk) THEN ELSIF rising_edge(clk) THEN
state <= nxt_state; state <= nxt_state;
prev_state <= state;
burst_wr_cnt <= nxt_burst_wr_cnt; burst_wr_cnt <= nxt_burst_wr_cnt;
dvr_done <= nxt_dvr_done; dvr_done <= nxt_dvr_done;
cur_address <= nxt_cur_address; cur_address <= nxt_cur_address;
address_cnt <= nxt_address_cnt; address_cnt <= nxt_address_cnt;
burst_size <= nxt_burst_size; burst_size <= nxt_burst_size;
prev_state <= state;
END IF; END IF;
END PROCESS; END PROCESS;
...@@ -155,10 +150,10 @@ BEGIN ...@@ -155,10 +150,10 @@ BEGIN
ctlr_mosi.burstsize <= (OTHERS => '0'); ctlr_mosi.burstsize <= (OTHERS => '0');
wr_snk_out.ready <= '0'; wr_snk_out.ready <= '0';
nxt_burst_wr_cnt <= burst_wr_cnt;
nxt_dvr_done <= '0'; nxt_dvr_done <= '0';
nxt_cur_address <= cur_address; nxt_cur_address <= cur_address;
nxt_address_cnt <= address_cnt; nxt_address_cnt <= address_cnt;
nxt_burst_wr_cnt <= burst_wr_cnt;
CASE state IS CASE state IS
...@@ -167,8 +162,8 @@ BEGIN ...@@ -167,8 +162,8 @@ BEGIN
IF wr_snk_in.valid = '1' THEN -- it is allowed that valid is not always active during a burst IF wr_snk_in.valid = '1' THEN -- it is allowed that valid is not always active during a burst
wr_snk_out.ready <= '1'; -- wr side uses latency of 0, so wr_snk_out.ready<='1' acknowledges a successful write request. wr_snk_out.ready <= '1'; -- wr side uses latency of 0, so wr_snk_out.ready<='1' acknowledges a successful write request.
ctlr_mosi.wr <= '1'; ctlr_mosi.wr <= '1';
nxt_burst_wr_cnt <= INCR_UVEC(burst_wr_cnt, -1); nxt_burst_wr_cnt <= burst_wr_cnt-1;
IF UNSIGNED(burst_wr_cnt) = 1 THEN -- check for the last cycle of this burst sequence IF burst_wr_cnt = 1 THEN -- check for the last cycle of this burst sequence
nxt_state <= s_wr_request; -- initiate a new wr burst or goto idle via the wr_request state nxt_state <= s_wr_request; -- initiate a new wr burst or goto idle via the wr_request state
END IF; END IF;
END IF; END IF;
...@@ -187,7 +182,7 @@ BEGIN ...@@ -187,7 +182,7 @@ BEGIN
ctlr_mosi.burstsize <= TO_MEM_CTLR_BURSTSIZE(burst_size); -- burstsize >= 1 ctlr_mosi.burstsize <= TO_MEM_CTLR_BURSTSIZE(burst_size); -- burstsize >= 1
nxt_cur_address <= INCR_UVEC(cur_address, burst_size); nxt_cur_address <= INCR_UVEC(cur_address, burst_size);
nxt_address_cnt <= INCR_UVEC(address_cnt, -burst_size); nxt_address_cnt <= INCR_UVEC(address_cnt, -burst_size);
nxt_burst_wr_cnt <= TO_UVEC(burst_size-1, g_tech_ddr.maxburstsize_w); nxt_burst_wr_cnt <= burst_size-1;
-- Return for next wr request or perform any remaining writes in this burst -- Return for next wr request or perform any remaining writes in this burst
nxt_state <= s_wait; nxt_state <= s_wait;
IF burst_size > 1 THEN IF burst_size > 1 THEN
...@@ -228,10 +223,11 @@ BEGIN ...@@ -228,10 +223,11 @@ BEGIN
END IF; END IF;
WHEN s_idle => WHEN s_idle =>
nxt_dvr_done <= '1'; -- assert dvr_done after s_init or keep it asserted after a finished access
IF dvr_en = '1' THEN
nxt_cur_address <= dvr_start_address; nxt_cur_address <= dvr_start_address;
nxt_address_cnt <= dvr_nof_data; nxt_address_cnt <= dvr_nof_data;
nxt_burst_wr_cnt <= 0;
nxt_dvr_done <= '1'; -- assert dvr_done after s_init or keep it asserted after a finished access
IF dvr_en = '1' THEN
nxt_dvr_done <= '0'; nxt_dvr_done <= '0';
nxt_state <= s_wait; nxt_state <= s_wait;
END IF; END IF;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment