@@ -9,11 +9,10 @@ import firrtl2.options.TargetDirAnnotation
99import org .scalatest .flatspec .AnyFlatSpec
1010import org .scalatest .matchers .should .Matchers
1111import tech .rocksavage .chiselware .timer .param .TimerParams
12- import tech .rocksavage .chiselware .timer .TimerBasicTests
1312import tech .rocksavage .test ._
1413
15- /** Highly randomized test suite driven by configuration parameters. Includes
16- * code coverage for all top-level ports. Inspired by the DynamicFifo
14+ /** Highly randomized test suite driven by configuration parameters. Includes code coverage for all
15+ * top-level ports. Inspired by the DynamicFifo
1716 */
1817
1918class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
@@ -67,8 +66,8 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
6766 val dataWidth = 32
6867 val addrWidth = 32
6968 val wordWidth = 8
70- val countWidth = 32
71- val prescalerWidth = 32
69+ val countWidth = 8
70+ val prescalerWidth = 8
7271
7372 // Pass in randomly selected values to DUT
7473 val timerParams =
@@ -91,12 +90,11 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
9190 testName match {
9291 // Test case for Master Mode Initialization
9392 case " formal" =>
94- " TimerInner" should " Formally Verify" in {
93+ " TimerInner" should " Formally Verify" in
9594 verify(
9695 new TimerInnerFVHarness (timerParams, true ),
97- Seq (BoundedCheck (40 ))
96+ Seq (BoundedCheck (40 )),
9897 )
99- }
10098 case " pwm_ceiling_test" =>
10199 it should " verify PWM ceiling functionality" in {
102100 val cov = test(new Timer (timerParams, false ))
@@ -108,7 +106,7 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
108106 testName,
109107 configName,
110108 coverage,
111- covDir
109+ covDir,
112110 )
113111 }
114112 case " prescaler_change_test" =>
@@ -117,15 +115,15 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
117115 .withAnnotations(backendAnnotations) { dut =>
118116 TimerBasicTests .testPrescalerChange(
119117 dut,
120- timerParams
118+ timerParams,
121119 )
122120 }
123121 coverageCollector.collectCoverage(
124122 cov.getAnnotationSeq,
125123 testName,
126124 configName,
127125 coverage,
128- covDir
126+ covDir,
129127 )
130128 }
131129 case " low_maxcount_dutycycle_test" =>
@@ -134,15 +132,15 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
134132 .withAnnotations(backendAnnotations) { dut =>
135133 TimerBasicTests .testLowMaxCountDutyCycle(
136134 dut,
137- timerParams
135+ timerParams,
138136 )
139137 }
140138 coverageCollector.collectCoverage(
141139 cov.getAnnotationSeq,
142140 testName,
143141 configName,
144142 coverage,
145- covDir
143+ covDir,
146144 )
147145 }
148146 case " random_test" =>
@@ -151,58 +149,55 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
151149 .withAnnotations(backendAnnotations) { dut =>
152150 TimerBasicTests .testRandomMaxCountAndPrescaler(
153151 dut,
154- timerParams
152+ timerParams,
155153 )
156154 }
157155 coverageCollector.collectCoverage(
158156 cov.getAnnotationSeq,
159157 testName,
160158 configName,
161159 coverage,
162- covDir
160+ covDir,
163161 )
164162 }
165163 case " basic" =>
166164 it should " pass a basic test" in {
167165 val cov = test(
168166 new Timer (
169167 timerParams,
170- false
171- )
168+ false ,
169+ ),
172170 )
173171 .withAnnotations(backendAnnotations) { dut =>
174172 TimerBasicTests .timerBasicTest(
175173 dut,
176- timerParams
174+ timerParams,
177175 )
178176 }
179177 coverageCollector.collectCoverage(
180178 cov.getAnnotationSeq,
181179 testName,
182180 configName,
183181 coverage,
184- covDir
182+ covDir,
185183 )
186184 }
187185 case _ => allTests(timerParams, configName, covDir, coverage)
188186 }
189- it should " generate cumulative coverage report" in {
187+ it should " generate cumulative coverage report" in
190188 coverageCollector.saveCumulativeCoverage(coverage, covDir)
191- }
192189 }
193190
194191 def allTests (
195192 timerParams : TimerParams ,
196193 configName : String ,
197194 covDir : String ,
198- coverage : Boolean
199- ): Unit = {
200- " TimerInner" should " Formally Verify" in {
195+ coverage : Boolean ): Unit = {
196+ " TimerInner" should " Formally Verify" in
201197 verify(
202198 new TimerInnerFVHarness (timerParams, true ),
203- Seq (BoundedCheck (40 ))
199+ Seq (BoundedCheck (40 )),
204200 )
205- }
206201
207202 it should " verify PWM ceiling functionality" in {
208203 val testName = " pwm_ceiling_test"
@@ -215,7 +210,7 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
215210 testName,
216211 configName,
217212 coverage,
218- covDir
213+ covDir,
219214 )
220215 }
221216
@@ -230,7 +225,7 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
230225 testName,
231226 configName,
232227 coverage,
233- covDir
228+ covDir,
234229 )
235230 }
236231 it should " verify duty cycle with low maxCount over multiple cycles" in {
@@ -244,7 +239,7 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
244239 testName,
245240 configName,
246241 coverage,
247- covDir
242+ covDir,
248243 )
249244 }
250245 it should " verify timer with random maxCount and prescaler" in {
@@ -253,15 +248,15 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
253248 .withAnnotations(backendAnnotations) { dut =>
254249 TimerBasicTests .testRandomMaxCountAndPrescaler(
255250 dut,
256- timerParams
251+ timerParams,
257252 )
258253 }
259254 coverageCollector.collectCoverage(
260255 cov.getAnnotationSeq,
261256 testName,
262257 configName,
263258 coverage,
264- covDir
259+ covDir,
265260 )
266261 }
267262 it should " pass a basic test" in {
@@ -271,15 +266,15 @@ class TimerTest extends AnyFlatSpec with ChiselScalatestTester with Matchers {
271266 .withAnnotations(backendAnnotations) { dut =>
272267 TimerBasicTests .timerBasicTest(
273268 dut,
274- timerParams
269+ timerParams,
275270 )
276271 }
277272 coverageCollector.collectCoverage(
278273 cov.getAnnotationSeq,
279274 testName,
280275 configName,
281276 coverage,
282- covDir
277+ covDir,
283278 )
284279 }
285280 }
0 commit comments