Tapojyoti Mandal
Newbie level 5
- Joined
- Jan 21, 2015
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 99
Code:
--This is a single process design of the FSM
Process(clk,rst)
begin
--Initialization of signals
state_s<=idle;
Tag_we_s<='0';
Dataram_we_s<='0';
Tag_write_s<="XX";
Valid_write_s<='X';
Dirty_write_s<='X';
Dataram_input_sel_s<='X';
Mem_we_out<='0';
Mem_Addr_out<="XXXXXXXX";
cpu_ready_out<='0';
Mem_valid_out<='0';
IF rst='1' THEN
state_s<=idle;
cpu_ready_out<='1';
ELSIF clk'EVENT and clk='1' THEN
CASE state_s IS
WHEN idle=>
IF Cpu_valid_in='1' THEN
state_s<=compare_tag;
cpu_ready_out<='0';
ELSE
state_s<=state_s;
cpu_ready_out<='1';
END IF;
WHEN compare_tag =>
IF Hit_s='1' THEN
IF Cpu_we_in='0' THEN
state_s<=idle;
cpu_ready_out<='1';
ELSIF Cpu_we_in='1' THEN
state_s<=nothing;
Tag_we_s<='1';
Dataram_we_s<='1';
Tag_write_s<=Tag_read_s;
Valid_write_s<='1';
Dirty_write_s<='1';
Dataram_input_sel_s<='0';
cpu_ready_out<='0';
END IF;
ELSIF (Hit_s='0') THEN
IF Dirty_read_s='0' THEN
IF (Valid_read_s='0' and Cpu_we_in='1') THEN
state_s<=nothing;
Tag_we_s<='1';
Dataram_we_s<='1';
Tag_write_s<=Cpu_addr_in(7 downto 6);
Valid_write_s<='1';
Dirty_write_s<='1';
Dataram_input_sel_s<='0';
cpu_ready_out<='0';
ELSE
state_s<=allocate;
Tag_we_s<='1';
Dataram_we_s<='0';
Tag_write_s<=Cpu_addr_in(7 downto 6);
Valid_write_s<='1';
Dirty_write_s<=Cpu_we_in;
--memory request from main mermory
Mem_valid_out<='1';
cpu_ready_out<='0';
Mem_we_out<='0';
Mem_Addr_out<=Cpu_addr_in;
END IF;
ELSIF (Dirty_read_s='1') THEN
state_s<=write_back;
Tag_we_s<='1';
Dataram_we_s<='0';
Tag_write_s<=Cpu_addr_in(7 downto 6);
Valid_write_s<='1';
Dirty_write_s<=Cpu_we_in;
Dataram_input_sel_s<='X';
--memory request from main mermory
Mem_valid_out<='1';
cpu_ready_out<='0';
Mem_Addr_out<=Tag_read_s & Cpu_addr_in(5 downto 0);
Mem_we_out<='1';
END IF;
END IF;
WHEN allocate =>
cpu_ready_out<='0';
IF(Mem_ready_in='1') THEN
state_s<=compare_tag;
Dataram_we_s<='1';
Dataram_input_sel_s<='1';
Mem_we_out<='0';
Mem_Addr_out<=Cpu_addr_in;
Mem_valid_out<='0';
ELSE
state_s<=state_s;
Mem_we_out<='0';
Mem_Addr_out<=Cpu_addr_in;
Mem_valid_out<='1';
END IF;
WHEN write_back =>
cpu_ready_out<='0';
IF (Mem_ready_in='1') THEN
state_s<=allocate;
Mem_we_out<='0';
Mem_Addr_out<=Cpu_addr_in;
Mem_valid_out<='1';
ELSE
state_s<=state_s;
Mem_we_out<='1';
Mem_Addr_out<=Tag_read_s & Cpu_addr_in(5 downto 0);
Mem_valid_out<='1';
END IF;
WHEN nothing =>
state_s<=idle;
cpu_ready_out<='1';
END CASE;
END IF;
END Process;
I have checked other posts who had similar query but there the problem was that they were not strictly following the syntax recommended for synchronous design. I am trying to design a FSM using a single Process syntax as provided in Xilinx XST guide and i am strictly following the syntax provided in guide.
I have reviewed the code multiple times and I hope I have not made any syntactical errors, yet I am getting this error.
Is the use of multiple If-else inside the CASE causing the error? But in XST guide also they have used similar code.