Skip to content

Commit a3c2e45

Browse files
committed
Fix the queue size calculation of TileWriter
1 parent 0ea9723 commit a3c2e45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/scala/graphics/TileWriter.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ class TileWriter extends Module {
3535
val size = RegInit(0.U(unsignedBitLength(buf.length).W))
3636

3737
val nextRear = Mux(rear =/= (buf.length - 1).U, rear + 1.U, 0.U)
38+
val nextSize = WireDefault(size)
3839
val full = nextRear === fron
3940
io.inReq.ready := !full
4041
when (!full && io.inReq.valid) {
4142
buf.write(rear, io.inReq.bits)
4243
rear := nextRear
43-
size := size + 1.U
44+
nextSize := size + 1.U
45+
size := nextSize
4446
}
4547

4648
val col = RegInit(0.U(log2Up(Tile.nrCols).W))
@@ -72,7 +74,7 @@ class TileWriter extends Module {
7274
when (fron === (buf.length - Tile.nrCols).U) {
7375
nextFron := 0.U
7476
}
75-
size := size - Tile.nrCols.U
77+
size := nextSize - Tile.nrCols.U
7678
}
7779
}
7880
}

0 commit comments

Comments
 (0)