Skip to content

Commit

Permalink
Export local counter from timeWb component. (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
rslawson authored Mar 3, 2025
1 parent d69ed50 commit d56a61e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bittide-instances/src/Bittide/Instances/Hitl/VexRiscv.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ vexRiscvInner jtagIn0 uartRx =
[timeBus, uartBus, statusRegisterBus] <- processingElement NoDumpVcd peConfig -< jtag
(uartTx, _uartStatus) <-
uartInterfaceWb @dom d16 d16 (uartDf baud) -< (uartBus, uartRx)
timeWb -< timeBus
_localCounter <- timeWb -< timeBus
testResult <- statusRegister -< statusRegisterBus
idC -< (testResult, uartTx)

Expand Down
2 changes: 1 addition & 1 deletion bittide-instances/src/Bittide/Instances/Pnr/Ethernet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ vexRiscGmii SNat sysClk sysRst rxClk rxRst txClk txRst fwd =
( circuit $ \(uartTx, gmiiRx, jtag) -> do
[uartBus, timeBus, wbAxiRx, wbAxiTx, dnaWb, gpioWb, macWb] <- pe -< jtag
(uartRx, _uartStatus) <- uart -< (uartBus, uartTx)
time -< timeBus
_localCounter <- time -< timeBus
_dna <- dnaC -< dnaWb
macStatIf -< (macWb, macStatus)
gpioDf <- idleSource -< ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ vexRiscUartHello diffClk rst_in =
[uartBus, timeBus] <- processingElement @Basic200 NoDumpVcd peConfig -< jtag
(uartTx, _uartStatus) <-
uartInterfaceWb d16 d16 (uartDf $ SNat @921600) -< (uartBus, uartRx)
timeWb -< timeBus
_localCounter <- timeWb -< timeBus
idC -< uartTx
where
(clk200, rst200_) = clockWizardDifferential diffClk noReset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dut localCounter dnaA dnaB = circuit $ do
(uartRx, jtagIdle) <- idleSource -< ()
[uartBus, timeBus, peBusA, peBusB] <- processingElement NoDumpVcd peConfig -< jtagIdle
(uartTx, _uartStatus) <- uartInterfaceWb d16 d2 uartSim -< (uartBus, uartRx)
timeWb -< timeBus
_localCounter <- timeWb -< timeBus
linkAB <- switchDemoPeWb d2 localCounter -< (peBusA, dnaAC, linkBA)
linkBA <- switchDemoPeWb d2 localCounter -< (peBusB, dnaBC, linkAB)
dnaAC <- signalToCSignal dnaA -< ()
Expand Down
2 changes: 1 addition & 1 deletion bittide-instances/tests/Wishbone/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dut = withClockResetEnable clockGen resetGen enableGen
(uartRx, jtag) <- idleSource -< ()
[uartBus, timeBus] <- processingElement NoDumpVcd peConfig -< jtag
(uartTx, _uartStatus) <- uartInterfaceWb d2 d2 uartSim -< (uartBus, uartRx)
timeWb -< timeBus
_localCounter <- timeWb -< timeBus
idC -< uartTx
where
(iMem, dMem) =
Expand Down
2 changes: 1 addition & 1 deletion bittide-instances/tests/Wishbone/Watchdog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dut = withClockResetEnable clockGen resetGen enableGen
<| (watchDogWb @_ @_ @4 "50 us" (SNat @(PeriodToCycles Basic200 (Microseconds 50))))
-< idleBusB

timeWb <| (watchDogWb @_ @_ @4 "" d0) -< timeBus
_localCounter <- timeWb <| (watchDogWb @_ @_ @4 "" d0) -< timeBus
(uartTx, _uartStatus) <- (uartInterfaceWb @_ @_ @4) d2 d2 uartSim -< (uartBus, uartRx)
idC -< uartTx
where
Expand Down
6 changes: 3 additions & 3 deletions bittide/src/Bittide/Wishbone.hs
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,11 @@ timeWb ::
, KnownNat addrW
, 1 <= DomainPeriod dom
) =>
Circuit (Wishbone dom 'Standard addrW (Bytes 4)) ()
timeWb = Circuit $ \(wbM2S, _) -> (mealy goMealy (False, 0, 0) wbM2S, ())
Circuit (Wishbone dom 'Standard addrW (Bytes 4)) (CSignal dom (Unsigned 64))
timeWb = Circuit $ \(wbM2S, _) -> unbundle $ mealy goMealy (False, 0, 0) wbM2S
where
goMealy (reqCmp0, scratch0 :: Unsigned 64, count :: Unsigned 64) wbM2S =
((reqCmp1, scratch1, succ count), wbS2M1)
((reqCmp1, scratch1, succ count), (wbS2M1, count))
where
freq = natToNum @(DomainToHz dom) :: Unsigned 64
RegisterBank (splitAtI -> (freqMsbs, freqLsbs)) = getRegsBe @8 freq
Expand Down

0 comments on commit d56a61e

Please sign in to comment.