Skip to content

Commit

Permalink
Merge pull request #161 from wunderabt/decoupledgcd-with-backpressure-v2
Browse files Browse the repository at this point in the history
 honor the 'ready' signal from the GCD output (v2)
  • Loading branch information
chick authored Aug 20, 2021
2 parents 3f0038f + c11111d commit a064e05
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions 2.6_chiseltest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
" val in = IO(Flipped(Decoupled(ioType)))\n",
" val out = IO(Decoupled(ioType))\n",
" out <> Queue(in, entries)\n",
"}\n"
"}"
]
},
{
Expand Down Expand Up @@ -339,7 +339,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"test(QueueModule(UInt(9.W), entries = 200)) { c =>\n",
" // Example testsequence showing the use and behavior of Queue\n",
" c.in.initSource()\n",
Expand Down Expand Up @@ -434,12 +433,13 @@
" y := y - x\n",
" }\n",
" when(y === 0.U) {\n",
" // when y becomes zero computation is over, signal valid data to output\n",
" // when y becomes zero computation is over,\n",
" // signal valid data to output if the output is ready\n",
" output.bits.value1 := xInitial\n",
" output.bits.value2 := yInitial\n",
" output.bits.gcd := x\n",
" output.valid := true.B\n",
" busy := false.B\n",
" busy := ! output.ready\n",
" }\n",
" }.otherwise {\n",
" when(input.valid) {\n",
Expand All @@ -453,7 +453,7 @@
" resultValid := false.B\n",
" }\n",
" }\n",
"}\n"
"}"
]
},
{
Expand Down Expand Up @@ -498,7 +498,10 @@
" fork {\n",
" dut.input.enqueueSeq(inputSeq)\n",
" }.fork {\n",
" dut.output.expectDequeueSeq(resultSeq)\n",
" for (expected <- resultSeq) {\n",
" dut.output.expectDequeue(expected)\n",
" dut.clock.step(5) // wait some cycles before receiving the next output to create backpressure\n",
" }\n",
" }.join()\n",
"}\n"
]
Expand Down

0 comments on commit a064e05

Please sign in to comment.