Fix UARTAdapter div bits

This commit is contained in:
Jerry Zhao
2023-10-12 15:37:03 -07:00
parent 3cbcf6b6e8
commit deab3b11b6

View File

@@ -42,7 +42,7 @@ class WithGPIOTiedOff extends HarnessBinder({
// DOC include start: WithUARTAdapter // DOC include start: WithUARTAdapter
class WithUARTAdapter extends HarnessBinder({ class WithUARTAdapter extends HarnessBinder({
case (th: HasHarnessInstantiators, port: UARTPort) => { case (th: HasHarnessInstantiators, port: UARTPort) => {
val div = (th.getHarnessBinderClockFreqMHz * 1000000 / port.io.c.initBaudRate.toDouble).toInt val div = (th.getHarnessBinderClockFreqMHz.toDouble * 1000000 / port.io.c.initBaudRate.toDouble).toInt
val uart_sim = Module(new UARTAdapter(port.uartNo, div, false)).suggestName(s"uart_sim_uartno${port.uartNo}") val uart_sim = Module(new UARTAdapter(port.uartNo, div, false)).suggestName(s"uart_sim_uartno${port.uartNo}")
uart_sim.io.uart.txd := port.io.txd uart_sim.io.uart.txd := port.io.txd
port.io.rxd := uart_sim.io.uart.rxd port.io.rxd := uart_sim.io.uart.rxd