rahdirs
Advanced Member level 1
- Joined
- May 22, 2013
- Messages
- 424
- Helped
- 93
- Reputation
- 192
- Reaction score
- 91
- Trophy points
- 1,308
- Location
- Mordor
- Activity points
- 4,492
Hi,
I have attached a snapshot of my testbench waveform.
In the snapshot,u can see that clr signal is usually 'X' & in between it goes to '1'.
This maybe because i'm driving clr signal at multiple places to different values.But my question is because it remains at only at one state at a time,shouldn't only one source be driving it ?
I've attached code,but it is lengthy
I have attached a snapshot of my testbench waveform.
In the snapshot,u can see that clr signal is usually 'X' & in between it goes to '1'.
This maybe because i'm driving clr signal at multiple places to different values.But my question is because it remains at only at one state at a time,shouldn't only one source be driving it ?
I've attached code,but it is lengthy
Code:
NEXT_STATE_DECODE: process (state,clk,rst,init_calib_complete)
begin
--declare default state for next_state to avoid latches
next_state <= state; --default is to stay in current state
--insert statements to decode next_state
--below is a simple example
case (state) is
when st1_reset =>
if rst = '1' then
next_state <= st1_reset;
clr <= '1';
else
next_state <= st2_idle;
clr <= '1';
end if;
when st2_idle =>
if init_calib_complete = '1' then
next_state <= st3_write;
clr <= '1';
else
next_state <= st2_idle;
end if;
when st3_write =>
if(count = 1500) then
next_state <= st4_wait;
clr <= '1';
ui_c0_app_addr_i <= "111111111111111111111111111";
ui_c0_app_cmd_i <= "111";
ui_c0_app_en_i <= '0';
ui_c0_app_wdf_wren_i <= '0';
ui_c0_app_wdf_end_i <= '0';
wr_en_i <= '0';
rd_en_i <= '0';
else
next_state <= st3_write;
if(app_rdy_1 = '1') then
clr <= '0';
ui_c0_app_addr_i <= addr_count;
ui_c0_app_cmd_i <= "000";
ui_c0_app_en_i <= '1';
ui_c0_app_wdf_wren_i <= '1';
ui_c0_app_wdf_end_i <= '1';
wr_en_i <= '1';
rd_en_i <= '1';
else
clr <= '0';
ui_c0_app_addr_i <= addr_count;
ui_c0_app_cmd_i <= "000";
ui_c0_app_en_i <= '1';
ui_c0_app_wdf_wren_i <= '1';
ui_c0_app_wdf_end_i <= '1';
wr_en_i <= '1';
rd_en_i <= '0';
end if;
end if;
when st4_wait =>
if(count = 157) then
next_state <= st5_read;
clr <= '1';
else
clr <= '0';
next_state <= st4_wait;
end if;
when st5_read =>
if(count = 1500) then
next_state <= st1_reset;
clr <= '1';
ui_c0_app_en_i <= '0';
ui_c0_app_cmd_i <= "111";
else
next_state <= st5_read;
if(app_rdy_1 = '1') then
clr <= '0';
ui_c0_app_en_i <= '1';
ui_c0_app_cmd_i <= "001";
ui_c0_app_addr_i <= addr_count;
end if;
end if;
when others =>
next_state <= st1_reset;
end case;
end process;
end fsm_logic;