uart: power-on with the right divider for the design (#15)
authorWesley W. Terpstra <wesley@sifive.com>
Sun, 14 May 2017 06:38:20 +0000 (23:38 -0700)
committerGitHub <noreply@github.com>
Sun, 14 May 2017 06:38:20 +0000 (23:38 -0700)
src/main/scala/devices/uart/UART.scala

index 9b3dfaa37110cb6bdd7c93f7baf99fbda52908c8..e6349f12565fa55dab57bba33b6e7ee58ada3a7d 100644 (file)
@@ -203,7 +203,7 @@ trait HasUARTTopModuleContents extends Module with HasUARTParameters with HasReg
   val rxm = Module(new UARTRx(params))
   val rxq = Module(new Queue(rxm.io.out.bits, uartNRxEntries))
 
-  val divinit = 542 // (62.5MHz / 115200)
+  val divinit = p(diplomacy.DTSTimebase) * p(rocketchip.RTCPeriod) / 115200
   val div = Reg(init = UInt(divinit, uartDivisorBits))
 
   private val stopCountBits = log2Up(uartStopBits)