Fix single-stage pipeline validity update issue
Enhanced the PipelineController's validity logic to handle single-stage configurations properly. This update ensures that the validity bit is correctly updated for systems that operate with only one pipeline stage, addressing a potential logic flaw in previous versions. Additionally, clarified documentation for random number generation in pipeline testbench.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
----------------------------------------------------------------------------------
|
||||
--@ - Name: **Pipeline Controller**
|
||||
--@ - Version: 0.0.1
|
||||
--@ - Version: 0.0.2
|
||||
--@ - Author: _Maximilian Passarello ([Blog](mpassarello.de))_
|
||||
--@ - License: [MIT](LICENSE)
|
||||
--@
|
||||
@@ -46,6 +46,7 @@
|
||||
--@
|
||||
--@ ## History
|
||||
--@ - 0.0.1 (2024-03-24) Initial version
|
||||
--@ - 0.0.2 (2024-04-13) Enhanced the validity update logic to correctly handle configurations with a single pipeline stage
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
@@ -136,7 +137,11 @@ begin
|
||||
R_Valid <= (others => '0');
|
||||
elsif I_CE = '1' then
|
||||
if C_Ready = '1' then
|
||||
R_Valid <= R_Valid(R_Valid'high - 1 downto R_Valid'low) & I_Valid;
|
||||
if G_PipelineStages = 1 then
|
||||
R_Valid(0) <= I_Valid;
|
||||
else
|
||||
R_Valid <= R_Valid(R_Valid'high - 1 downto R_Valid'low) & I_Valid;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
@@ -8,8 +8,14 @@ entity Pipeline_tb is
|
||||
end entity Pipeline_tb;
|
||||
|
||||
architecture behavior of Pipeline_tb is
|
||||
shared variable seed1 : integer := 483;
|
||||
shared variable seed2 : integer := 847;
|
||||
-- Random number generator
|
||||
--@ Select a random number for `seed1` to generate random numbers
|
||||
shared variable seed1 : integer := 483;
|
||||
--@ Select a random number for `seed2` to generate random numbers
|
||||
shared variable seed2 : integer := 847;
|
||||
--@ Generate a random number between `min_val` and `max_val`
|
||||
--@ You must provide the `shared variable seed1` and `shared variable seed2` to generate random numbers.
|
||||
--@ You need `use ieee.math_real.all;` to use this function.
|
||||
impure function rand_int(min_val, max_val : integer) return integer is
|
||||
variable r : real;
|
||||
begin
|
||||
|
Reference in New Issue
Block a user