I donot see the initial value from FPGA IP until I send an empty useless value to IP input (which is CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal). In my view a simple software reset (CHECKPPC6_mReset) should have initialized the IP and given me the output value I assign in ASSIGN_VARS case of my IP.
My IP design is such that. IP asks the input of chemical molecules. then perform reaction and wait for ACK signal from PPC to continue with the next round.
But the problems I face are. I have to (CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal) for no intuitive reason. Then when I provide ACK signal, IP doesnt move on to start Reaction again untill I provide another dummy input (CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal).
I believe next_state doesnot get updated, which is why it happens, can you guys please help me with this and suggest a solution.
In your code, you have commented out the state change part of the state machine. (current_state <= next state). So your state machine is stuck in assign_vars.
- - - Updated - - -
You also commented out all the "avoid latch" sections. In your state machine you need to make sure you assign ALL signals in ALL cases. There are 2 simple ways to avoid this:
1. Give every signal a default assignment before the case statement.
2. Make the state machine a single clocked process.
1. current_state <= next state is a mistake in this file only which I corrected. I ran the project including this line of code.
2. Avoid latch part is doing exactly what you are saying. It is including all signals with default values. Signals that are updated, are assigned new values above this part of code.
In terms of Latches, this code is clean. Checked in ISE Synthesizer.
So, problem is not one of those, that you are mentioning.
Please help me find one. Or give me an idea, what could actually be wrong here?
yes, and the simulation is all fine. I see no problems there. I even simulated post synthesis vhdl file.
The testbench code I use is :
Code:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_unsigned.all;
USE std.textio.all;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--USE ieee.numeric_std.ALL;
ENTITY TestBench IS
END TestBench;
ARCHITECTURE behavior OF TestBench IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT GLYCOLYSIS
PORT(
clk : IN std_logic;
reset : IN std_logic;
INPUT32 : IN std_logic_vector(31 downto 0);
OUTPUT32 : OUT std_logic_vector(31 downto 0)
);
END COMPONENT;
--Inputs
signal clk : std_logic := '0';
signal reset : std_logic := '0';
signal Input32 : std_logic_vector(31 downto 0) := (others => '0');
--Outputs
signal Output32 : std_logic_vector(31 downto 0);
-- Clock period definitions
constant clk_period : time := 10 ns;
--
SIGNAL ADDRESS_A : std_logic_vector(9 DOWNTO 0):= (others => '0');
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: GLYCOLYSIS PORT MAP (
clk => clk,
reset => reset,
INPUT32 => Input32,
OUTPUT32 => Output32
);
-- Clock process definitions
clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process clk_process;
--
reset <= '1' after 0 ns, '0' after 20 ns;
process(Output32)
--VARIABLE ADDRESS_A : STD_LOGIC_VECTOR(9 downto 0) := (others => '0');
begin
-- IF (Output32 = B"00000000000000000000000000000000") THEN --EMPTY
-- Input32 <= B"00000000000000000000000000000000";
-- END IF;
IF (Output32(31 DOWNTO 27) = B"00100") THEN --glucose_FPGA
Input32 <= B"00100000000000000000001111111111";
END IF;
IF (Output32(31 DOWNTO 27) = B"00101") THEN --ATP_FPGA
Input32 <= B"00101000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"00110") THEN --glucose_6_phosphate_FPGA
Input32 <= B"00110000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"00111") THEN --ADP_FPGA
Input32 <= B"00111000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01000") THEN --fructose_6_phosphate_FPGA
Input32 <= B"01000000000000000010011100010000";
end if;
IF (Output32(31 DOWNTO 27) = B"01001") THEN --fructose_1_6_bisphosphate_FPGA
Input32 <= B"01001000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01010") THEN --dihydroxyacetone_phosphate_FPGA
Input32 <= B"01010000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01011") THEN --glyceraldehyde_3_phosphate_FPGA
Input32 <= B"01011000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01100") THEN --bisphosphoglycerate_1_3_FPGA
Input32 <= B"01100000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01101") THEN --phosphoglycerate_3_FPGA
Input32 <= B"01101000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01110") THEN --phosphoglycerate_2_FPGA
Input32 <= B"01110000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"01111") THEN --phosphoenolpyruvate_FPGA
Input32 <= B"01111000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"10000") THEN --pyruvate_FPGA
Input32 <= B"10000000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"10001") THEN --Pi_FPGA
Input32 <= B"10001000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"10010") THEN --H2O_FPGA
Input32 <= B"10010000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"10011") THEN --NAD_FPGA
Input32 <= B"10011000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"10100") THEN --NADH_FPGA
Input32 <= B"10100000000000000010011100010000";
END IF;
IF (Output32(31 DOWNTO 27) = B"10101") THEN --H_FPGA
Input32 <= B"10101000000000000010011100010000";
END IF;
--
END PROCESS;
END;
Are you sure everything else is set up correctly around this module?
Have you testbenched the FIFO input aswell? are there problems there?
This is not really a problem anything bigger than debugging. Your testbench in very small and only covers a small number of cases - why not cover them all?
Im pretty sure the problem will be in the RTL, not on the chip. I suspect you arnt doing thorough enough testing.
Are you sure everything else is set up correctly around this module?
Have you testbenched the FIFO input aswell? are there problems there?
This is not really a problem anything bigger than debugging. Your testbench in very small and only covers a small number of cases - why not cover them all?
Im pretty sure the problem will be in the RTL, not on the chip. I suspect you arnt doing thorough enough testing.
some remark, don't know if it is your problem : if i look here :
Code:
if ( WFIFO2IP_empty = '0' and RFIFO2IP_full = '0' ) then
fifo_rdreq_cmb <= '1';
fifo_cntl_ns <= RD_REQ;
end if;
basically, if you read from fifo what should care about is your empty flag
and not your full flag. (when you read data - data is poped out, so fifo will not be full).
so in case your fifo was full - you will not read it and will be stucked.
TrickyDicky, I am pretty sure, everything else is fine. About FIFO, I was too lazy to even think about it. Because, it will take lot of time in debugging. I pray, that it is not FIFO . But I guess, I have to take that into consideration.
aruipksni, thanks for suggestion. I will try to find, if this is the problem.
TrickyDicky & aruipksni, what do you think, is it better to use software registers instead of FIFO?
TrickyDicky, I am pretty sure, everything else is fine. About FIFO, I was too lazy to even think about it. Because, it will take lot of time in debugging. I pray, that it is not FIFO . But I guess, I have to take that into consideration.
aruipksni, thanks for suggestion. I will try to find, if this is the problem.
TrickyDicky & aruipksni, what do you think, is it better to use software registers instead of FIFO?