Skip to content

Commit c11111d

Browse files
committed
wait some cycles before receiving the next GCD output to create backpressure
1 parent 3f0038f commit c11111d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

2.6_chiseltest.ipynb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
" val in = IO(Flipped(Decoupled(ioType)))\n",
215215
" val out = IO(Decoupled(ioType))\n",
216216
" out <> Queue(in, entries)\n",
217-
"}\n"
217+
"}"
218218
]
219219
},
220220
{
@@ -339,7 +339,6 @@
339339
"metadata": {},
340340
"outputs": [],
341341
"source": [
342-
"\n",
343342
"test(QueueModule(UInt(9.W), entries = 200)) { c =>\n",
344343
" // Example testsequence showing the use and behavior of Queue\n",
345344
" c.in.initSource()\n",
@@ -434,12 +433,13 @@
434433
" y := y - x\n",
435434
" }\n",
436435
" when(y === 0.U) {\n",
437-
" // when y becomes zero computation is over, signal valid data to output\n",
436+
" // when y becomes zero computation is over,\n",
437+
" // signal valid data to output if the output is ready\n",
438438
" output.bits.value1 := xInitial\n",
439439
" output.bits.value2 := yInitial\n",
440440
" output.bits.gcd := x\n",
441441
" output.valid := true.B\n",
442-
" busy := false.B\n",
442+
" busy := ! output.ready\n",
443443
" }\n",
444444
" }.otherwise {\n",
445445
" when(input.valid) {\n",
@@ -453,7 +453,7 @@
453453
" resultValid := false.B\n",
454454
" }\n",
455455
" }\n",
456-
"}\n"
456+
"}"
457457
]
458458
},
459459
{
@@ -498,7 +498,10 @@
498498
" fork {\n",
499499
" dut.input.enqueueSeq(inputSeq)\n",
500500
" }.fork {\n",
501-
" dut.output.expectDequeueSeq(resultSeq)\n",
501+
" for (expected <- resultSeq) {\n",
502+
" dut.output.expectDequeue(expected)\n",
503+
" dut.clock.step(5) // wait some cycles before receiving the next output to create backpressure\n",
504+
" }\n",
502505
" }.join()\n",
503506
"}\n"
504507
]

0 commit comments

Comments
 (0)