VHDL-verification
Package to ease directed testing of HDL entities
Signals | Processes
compare_with_expected Architecture Reference

Architecture compares input data rate with expected data rate. More...

Detailed Description

Architecture compares input data rate with expected data rate.

After first valid data is seen, internally counts from 0 to THROUGHPUT - 1 and checks if valid is '1' when expected

Definition at line 44 of file throughputchecker.vhd.

Processes

expecting_valid  ( )
 Computes expected value for valid and reports an error if actual value is different.

Signals

cycle_count  integer := THROUGHPUT - 1
 Cycles until next expected data.
valid_count  integer := 0
 Valid data seen.
expected_valid  std_logic := ' 1 '
 Expected value for 'valid'.

Member Function Documentation

◆ expecting_valid()

expecting_valid ( )
Process

Computes expected value for valid and reports an error if actual value is different.

Manages this by waiting for first valid and keeping an internal count. When endsim is asserted, reports total valid data seen

Definition at line 60 of file throughputchecker.vhd.

expecting_valid : process
60 
61  begin
62 
63  -- wait until the first valid to start counting down
64  while (valid /= '1') loop
65  wait until rising_edge(clk);
66  end loop;
67 
68  while (endsim /= '1') loop
69 
70  assert (valid = '0' OR valid = '1')
71  report "throughputchecker(" & SIMULATION_LABEL & "): invalid value for valid, should only have '0' or '1'! (got '" & std_logic'image(valid) & "')"
72  severity failure;
73 
74  if (valid /= expected_valid) then
75  if (valid = '1' and expected_valid = '0') then
76  report "throughputchecker(" & SIMULATION_LABEL & "): ERROR: data valid " & integer'image(cycle_count + 1) & " cycles before expected" severity error;
77  end if;
78  end if;
79 
80  if (valid = '1') then
81  valid_count <= valid_count + 1;
82  print (DEBUG, "seen valid, valid_count: " & integer'image(valid_count + 1));
83  end if;
84 
85  if (cycle_count = 0) then
86  cycle_count <= THROUGHPUT - 1;
87  expected_valid <= '1';
88  else
89  cycle_count <= cycle_count - 1;
90  expected_valid <= '0';
91  end if;
92 
93  -- Wait for next rising edge of clk
94  -- if endsim is asserted, do not wait for the clk edge, because it will never come
95  wait until rising_edge(clk) or (endsim = '1');
96 
97  end loop;
98 
99  report "throughputchecker(" & SIMULATION_LABEL & "): test end. valid_count: " & integer'image(valid_count) severity note;
100 
101  wait;
102 
103  end process;
104 
in clkstd_logic
Input data is aligned to this clock.
SIMULATION_LABELstring := "throughputchecker"
To separate messages from different instances in simulation.
in endsimstd_logic
Active high, tells the process that last data from datagen was sent.
integer := 0 valid_count
Valid data seen.
DEBUGboolean := false
Print debug info (developers)
std_logic := '1' expected_valid
Expected value for &#39;valid&#39;.
THROUGHPUTinteger := 0
Wait cycles between valid data.
in validstd_logic
Active high, indicates data is valid.
integer := THROUGHPUT- 1 cycle_count
Cycles until next expected data.

The documentation for this class was generated from the following file: