@@ -47,8 +47,9 @@ module thresholding_tb;
4747 bit deep_pipeline;
4848 bit throttled; // throttle input and output interfaces occasionally
4949 } testcfg_t ;
50- localparam int unsigned TEST_CNT = 3 ;
50+ localparam int unsigned TEST_CNT = 4 ;
5151 localparam testcfg_t TESTS [TEST_CNT ] = '{
52+ testcfg_t'{ k: 5 , n: 1 , c: 1 , pe: 1 , sign: 0 , fparg: 0 , deep_pipeline: 0 , throttled: 0 } ,
5253 testcfg_t'{ k: 10 , n: 8 , c: 12 , pe: 3 , sign: 1 , fparg: 0 , deep_pipeline: 1 , throttled: 1 } ,
5354 testcfg_t'{ k: 8 , n: 3 , c: 8 , pe: 4 , sign: 0 , fparg: 0 , deep_pipeline: 0 , throttled: 1 } ,
5455 testcfg_t'{ k: 17 , n: 9 , c: 10 , pe: 5 , sign: 1 , fparg: 1 , deep_pipeline: 1 , throttled: 0 }
@@ -122,14 +123,27 @@ module thresholding_tb;
122123 .ordy, .ovld, .odat
123124 );
124125
126+ // Expected Ordering
127+ function val_t reord (input val_t x);
128+ automatic val_t res = x;
129+ if (SIGNED ) begin
130+ if (FPARG && x[K - 1 ]) res[K - 2 : 0 ] = ~ x[K - 2 : 0 ];
131+ res[K - 1 ] = ! x[K - 1 ];
132+ end
133+ return res;
134+ endfunction : reord
135+
125136 // - Threshold Definition --------
126137 typedef val_t threshs_t[C ][N ];
127138 threshs_t THRESHS;
128139 initial begin
140+ static val_t row[N ];
141+
129142 // Generate thresholds
130- void '(std :: randomize(THRESHS ));
131143 foreach(THRESHS [c]) begin
132- val_t row[N ] = THRESHS [c];
144+ static val_t [N - 1 : 0 ] r ;
145+ void '(std:: randomize (r));
146+ foreach (row[i]) row[i] = r[i];
133147 row.sort with (reord(item));
134148 THRESHS [c] = row;
135149 end
@@ -143,16 +157,6 @@ module thresholding_tb;
143157 end
144158 end
145159
146- // Expected Ordering
147- function val_t reord (input val_t x);
148- automatic val_t res = x;
149- if (SIGNED ) begin
150- if (FPARG && x[K - 1 ]) res[K - 2 : 0 ] = ~ x[K - 2 : 0 ];
151- res[K - 1 ] = ! x[K - 1 ];
152- end
153- return res;
154- endfunction : reord
155-
156160 // - Stimulus Driver -------------
157161 input_t QW [$]; // Input tracing
158162 addr_t QC [$]; // Readback tracking
0 commit comments