Skip to content

Commit c084715

Browse files
committed
BUGFIX: fixed psi_common_prbs_tb
1 parent 2c82a90 commit c084715

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Benoît Stef [benoit.stef@psi.ch]
99
* Daniele Felici [daniele.felici@psi.ch]
1010
* Patric Bucher [patric.bucher@psi.ch]
1111
* Rafael Basso [rafael.basso@psi.ch]
12+
* Radoslaw Rybaniec [radoslaw.rybaniec@psi.ch]
1213

1314
## License
1415
This library is published under [PSI HDL Library License](License.txt), which is [LGPL](LGPL2_1.txt) plus some additional exceptions to clarify the LGPL terms in the context of firmware development.

sim/config.tcl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,6 @@ add_tb_run
452452

453453
create_tb_run "psi_common_prbs_tb"
454454
tb_run_add_arguments \
455-
"-gwidth_g=8 -gseed_g=x\"00000015\"" \
456-
"-gwidth_g=8 -gseed_g=x\"00000006\"" \
457-
"-gwidth_g=12 -gseed_g=x\"00000F01\"" \
458-
"-gwidth_g=12 -gseed_g=x\"00000031\""
459-
add_tb_run
455+
"-gwidth_g=10 -gseed_g=x\"00000015\"" \
456+
"-gwidth_g=10 -gseed_g=x\"00000006\""
457+
add_tb_run

testbench/psi_common_prbs_tb/maximal_length_lfsr.vhd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
----------------------------------------------------------------------------------
2+
-- Original VHDL source code Copyright 1995-2021 DOULOS
3+
----------------------------------------------------------------------------------
4+
-- Copyright (c) 2023 by Paul Scherrer Institute, Switzerland
5+
-- All rights reserved.
6+
-- Authors: Rafael Basso, Radoslaw Rybaniec
7+
8+
-- Added seed input
9+
----------------------------------------------------------------------------------
10+
111
library IEEE;
212
use IEEE.std_logic_1164.all;
313

@@ -22,7 +32,7 @@ begin
2232
begin
2333
if RISING_EDGE(clock) then
2434
if reset = '1' then
25-
lfsr_reg <= (others => '1');
35+
lfsr_reg <= seed;
2636
else
2737
if str = '1' then
2838
lfsr_tap := lfsr_reg(6) xor lfsr_reg(9);

testbench/psi_common_prbs_tb/psi_common_prbs_tb.vhd

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
----------------------------------------------------------------------------------
22
-- Copyright (c) 2018 by Paul Scherrer Institute, Switzerland
33
-- All rights reserved.
4-
-- Authors: Rafael Basso
4+
-- Authors: Rafael Basso, Radoslaw Rybaniec
55
----------------------------------------------------------------------------------
66

77
----------------------------------------------------------------------------------
@@ -114,27 +114,20 @@ begin
114114

115115
-- Assertion process : It stores the first CYCLE generated data and then compares it
116116
-- with the next CYCLE generated data. The same data is expected.
117-
assrt_p : process(data)
117+
assrt_p : process(clk)
118118
begin
119119
if (rst = '0') then
120-
if (count < CYCLE - 1) then
121-
count <= count + 1;
122-
elsif (flag = '0') then
123-
flag <= '1';
124-
count <= 0;
125-
else
126-
done <= '1';
127-
end if;
128-
129-
if (flag = '1') then
130-
if width_g < 20 then
131-
assert data = mem(count) report "###ERROR### Mismatch on data!" severity error;
132-
elsif width_g = 10 then
120+
if rising_edge(clk) then
121+
if ostrb = '1' then
133122
StdlvCompareStdlv(data_test, data,"Mismatch data for PRBS-9");
123+
count <= count + 1;
124+
end if;
125+
if count = 1000 then
126+
done <= '1';
134127
end if;
135-
else
136-
mem(count) <= data;
137128
end if;
129+
else -- reset
130+
count <= 0;
138131
end if;
139132
end process;
140133

@@ -153,12 +146,18 @@ begin
153146
-----------------------------------------------------------
154147
-- TAG : check with doulos 10 bit lfsr version & seed FF
155148
-----------------------------------------------------------
156-
u_test : entity work.maximal_length_lfsr
149+
assert N = 10 report "Testbench supports only width_g = 10 bits" severity failure;
150+
151+
GEN_LFSR: if N = 10 generate
152+
u_test : entity work.maximal_length_lfsr
157153
port map(
158154
clock => clk,
159155
reset => rst,
160-
seed => seed(9 downto 0),
156+
seed => seed(N-1 downto 0),
161157
str => istrb,
162-
data_out => data_test);
163158

159+
160+
data_out => data_test);
161+
end generate GEN_LFSR;
162+
164163
end behav;

0 commit comments

Comments
 (0)