Hi,
I am trying to implement a Ring Oscilator on FPGA. First, I want to
simulate it to "see" a working code, then I will flash it on an FPGA
board, therefore I don't want to use "wait for.." statements in code.
The purpose is to make a physically unclonable function.
I am receiving simulation error during simulation:
ERROR: at 100 ns(10000): Iteration limit 10000 is reached. Possible zero
delay oscillation detected where simulation can not advance in time
because signals can not resolve to a stable value in File "....vhd" Line
45. Please correct this code in order to advance past the current
simulation time.
Can anoybody help me?
Maybe, is it because of optimization? How can I avoid optimization?
Thanks.
ISE WebPACK 14.7
Win 7 32-bit
source code:
1 | library IEEE;
|
2 | use IEEE.STD_LOGIC_1164.ALL;
|
3 |
|
4 | -- Uncomment the following library declaration if using
|
5 | -- arithmetic functions with Signed or Unsigned values
|
6 | --use IEEE.NUMERIC_STD.ALL;
|
7 |
|
8 | -- Uncomment the following library declaration if instantiating
|
9 | -- any Xilinx primitives in this code.
|
10 | --library UNISIM;
|
11 | --use UNISIM.VComponents.all;
|
12 |
|
13 | entity ro_puf is
|
14 | Port ( clk_i : in STD_LOGIC;
|
15 | rst_i : in STD_LOGIC;
|
16 | clk_o : buffer STD_LOGIC);
|
17 | end ro_puf;
|
18 |
|
19 | architecture Behavioral of ro_puf is
|
20 | signal chain :std_logic_vector(30 downto 0);
|
21 | attribute syn_keep: boolean;
|
22 | attribute syn_keep of chain: signal is true;
|
23 | begin
|
24 | gen_chain:
|
25 | for i in 1 to 30 generate
|
26 | chain(i) <= not chain(i-1);
|
27 | end generate;
|
28 | chain(0) <= not chain(30) or not rst_i;
|
29 |
|
30 | t_FF: process(rst_i, chain(0))
|
31 | begin
|
32 | if rst_i = '0' then
|
33 | clk_o <= '0';
|
34 | elsif rising_edge(chain(0)) then
|
35 | clk_o <= not clk_o;
|
36 | end if;
|
37 | end process t_FF;
|
38 |
|
39 | end Behavioral;
|
Test bench:
1 | LIBRARY ieee;
|
2 | USE ieee.std_logic_1164.ALL;
|
3 |
|
4 | -- Uncomment the following library declaration if using
|
5 | -- arithmetic functions with Signed or Unsigned values
|
6 | --USE ieee.numeric_std.ALL;
|
7 |
|
8 | ENTITY ro_tb IS
|
9 | END ro_tb;
|
10 |
|
11 | ARCHITECTURE behavior OF ro_tb IS
|
12 |
|
13 | -- Component Declaration for the Unit Under Test (UUT)
|
14 |
|
15 | COMPONENT ro_puf
|
16 | PORT(
|
17 | clk_i : IN std_logic;
|
18 | rst_i : IN std_logic;
|
19 | clk_o : BUFFER std_logic
|
20 | );
|
21 | END COMPONENT;
|
22 |
|
23 |
|
24 | --Inputs
|
25 | signal clk_i : std_logic := '0';
|
26 | signal rst_i : std_logic := '0';
|
27 |
|
28 | --Outputs
|
29 | signal clk_o : std_logic;
|
30 |
|
31 | -- Clock period definitions
|
32 | constant clk_i_period : time := 10 ns;
|
33 | -- constant clk_o_period : time := 10 ns;
|
34 |
|
35 | BEGIN
|
36 |
|
37 | -- Instantiate the Unit Under Test (UUT)
|
38 | uut: ro_puf PORT MAP (
|
39 | clk_i => clk_i,
|
40 | rst_i => rst_i,
|
41 | clk_o => clk_o
|
42 | );
|
43 |
|
44 | -- Clock process definitions
|
45 | clk_i_process :process
|
46 | begin
|
47 | clk_i <= '0';
|
48 | wait for clk_i_period/2;
|
49 | clk_i <= '1';
|
50 | wait for clk_i_period/2;
|
51 | end process;
|
52 |
|
53 | -- clk_o_process :process
|
54 | -- begin
|
55 | -- clk_o <= '0';
|
56 | -- wait for clk_o_period/2;
|
57 | -- clk_o <= '1';
|
58 | -- wait for clk_o_period/2;
|
59 | -- end process;
|
60 | --
|
61 |
|
62 | -- Stimulus process
|
63 | stim_proc: process
|
64 | begin
|
65 | -- hold reset state for 100 ns.
|
66 | wait for 100 ns;
|
67 | rst_i <= '1';
|
68 | wait for 50 ns;
|
69 | rst_i <= '0';
|
70 | wait for clk_i_period*100;
|
71 |
|
72 | -- insert stimulus here
|
73 |
|
74 | wait;
|
75 | end process;
|
76 |
|
77 | END;
|