Line 122... |
Line 122... |
|
|
begin
|
begin
|
|
|
-- Sanity Checks --------------------------------------------------------------------------
|
-- Sanity Checks --------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
assert not (num_roscs_c = 0) report "NEORV32 PROCESSOR CONFIG NOTE: TRNG - Total number of ring-oscillators has to be >0." severity error;
|
assert not (num_roscs_c = 0) report "NEORV32 PROCESSOR CONFIG ERROR: TRNG - Total number of ring-oscillators has to be >0." severity error;
|
assert not ((num_inv_start_c mod 2) = 0) report "NEORV32 PROCESSOR CONFIG NOTE: TRNG - Number of inverters in fisrt ring has to be odd." severity error;
|
assert not ((num_inv_start_c mod 2) = 0) report "NEORV32 PROCESSOR CONFIG ERROR: TRNG - Number of inverters in fisrt ring has to be odd." severity error;
|
assert not ((num_inv_inc_c mod 2) /= 0) report "NEORV32 PROCESSOR CONFIG NOTE: TRNG - Number of inverters increment for each next ring has to be even." severity error;
|
assert not ((num_inv_inc_c mod 2) /= 0) report "NEORV32 PROCESSOR CONFIG ERROR: TRNG - Number of inverters increment for each next ring has to be even." severity error;
|
|
|
|
|
-- Access Control -------------------------------------------------------------------------
|
-- Access Control -------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = trng_base_c(hi_abb_c downto lo_abb_c)) else '0';
|
acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = trng_base_c(hi_abb_c downto lo_abb_c)) else '0';
|
wren <= acc_en and wren_i;
|
wren <= acc_en and wren_i;
|
Line 188... |
Line 189... |
-- John von Neumann De-Biasing ------------------------------------------------------------
|
-- John von Neumann De-Biasing ------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
neumann_debiasing_sync: process(clk_i)
|
neumann_debiasing_sync: process(clk_i)
|
begin
|
begin
|
if rising_edge(clk_i) then
|
if rising_edge(clk_i) then
|
debiasing.sreg <= debiasing.sreg(debiasing.sreg'left-1 downto 0) & xor_all_f(osc_array_data);
|
debiasing.sreg <= debiasing.sreg(debiasing.sreg'left-1 downto 0) & xor_reduce_f(osc_array_data);
|
debiasing.state <= (not debiasing.state) and osc_array_en_out(num_roscs_c-1); -- start toggling when last RO is enabled -> process in every second cycle
|
debiasing.state <= (not debiasing.state) and osc_array_en_out(num_roscs_c-1); -- start toggling when last RO is enabled -> process in every second cycle
|
end if;
|
end if;
|
end process neumann_debiasing_sync;
|
end process neumann_debiasing_sync;
|
|
|
-- Edge detector --
|
-- Edge detector --
|
Line 223... |
Line 224... |
processing.cnt <= (others => '0');
|
processing.cnt <= (others => '0');
|
else
|
else
|
processing.cnt <= std_ulogic_vector(unsigned(processing.cnt) + 1);
|
processing.cnt <= std_ulogic_vector(unsigned(processing.cnt) + 1);
|
end if;
|
end if;
|
if (lfsr_en_c = true) then -- LFSR post-processing
|
if (lfsr_en_c = true) then -- LFSR post-processing
|
processing.sreg <= processing.sreg(processing.sreg'left-1 downto 0) & (xnor_all_f(processing.sreg and lfsr_taps_c) xnor debiasing.data);
|
processing.sreg <= processing.sreg(processing.sreg'left-1 downto 0) & ((not xor_reduce_f(processing.sreg and lfsr_taps_c)) xnor debiasing.data);
|
else -- NO post-processing
|
else -- NO post-processing
|
processing.sreg <= processing.sreg(processing.sreg'left-1 downto 0) & debiasing.data;
|
processing.sreg <= processing.sreg(processing.sreg'left-1 downto 0) & debiasing.data;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
Line 319... |
Line 320... |
signal enable_sreg : std_ulogic_vector(NUM_INV-1 downto 0); -- enable shift register
|
signal enable_sreg : std_ulogic_vector(NUM_INV-1 downto 0); -- enable shift register
|
signal sync_ff : std_ulogic_vector(1 downto 0); -- output signal synchronizer
|
signal sync_ff : std_ulogic_vector(1 downto 0); -- output signal synchronizer
|
|
|
begin
|
begin
|
|
|
-- Sanity Checks --------------------------------------------------------------------------
|
|
-- -------------------------------------------------------------------------------------------
|
|
assert not ((NUM_INV mod 2) = 0) report "NEORV32 PROCESSOR CONFIG NOTE: TNRG.ring_oscillator - Number of inverters in ring has to be odd." severity error;
|
|
|
|
|
|
-- Ring Oscillator ------------------------------------------------------------------------
|
-- Ring Oscillator ------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
ring_osc: process(enable_i, enable_sreg, inv_chain)
|
ring_osc: process(enable_i, enable_sreg, inv_chain)
|
begin
|
begin
|
-- Using individual enable signals for each inverter - derived from a shift register - to prevent the synthesis tool
|
-- Using individual enable signals for each inverter - derived from a shift register - to prevent the synthesis tool
|