1
0

uart: make it easy to simulate large text printouts (#33)

This commit is contained in:
Wesley W. Terpstra 2017-08-10 16:32:48 -07:00 committed by GitHub
parent 5b74df20a1
commit d973c659eb

View File

@ -69,10 +69,14 @@ class UARTTx(c: UARTParams)(implicit p: Parameters) extends UARTModule(c)(p) {
val out = Reg(init = Bits(1, 1)) val out = Reg(init = Bits(1, 1))
io.out := out io.out := out
val plusarg_tx = PlusArg("uart_tx", 1, "Enable/disable the TX to speed up simulation").orR
val busy = (counter =/= UInt(0)) val busy = (counter =/= UInt(0))
io.in.ready := io.en && !busy io.in.ready := io.en && !busy
when (io.in.fire()) { when (io.in.fire()) {
printf("%c", io.in.bits) printf("UART TX (%x): %c\n", io.in.bits, io.in.bits)
}
when (io.in.fire() && plusarg_tx) {
shifter := Cat(io.in.bits, Bits(0, 1)) shifter := Cat(io.in.bits, Bits(0, 1))
counter := Mux1H((0 until uartStopBits).map(i => counter := Mux1H((0 until uartStopBits).map(i =>
(io.nstop === UInt(i)) -> UInt(n + i + 1))) (io.nstop === UInt(i)) -> UInt(n + i + 1)))