Files
eb001/src/main/scala/backBoard/Dout16.scala

66 lines
1.4 KiB
Scala
Raw Normal View History

2024-06-11 18:29:02 +08:00
package BACK
import chisel3._
import chisel3.util._
trait BackBoardSlvOut16{ this: BackBoardSlvLocal =>
val outRegSync = Wire(UInt(16.W))
val mthodReg = RegInit(0.U(16.W))
val valueReg = RegInit(0.U(16.W))
val outPin = Wire(UInt(16.W))
outPin :=
Mux(statusPR === 3.U, outRegSync, (mthodReg & valueReg) | (~mthodReg & outRegSync))
}
class DOut16 extends BackBoardSlvLocal
2024-06-11 18:29:02 +08:00
with BackBoardSlvStatusPR
with BackBoardSlvOut16{
val out = IO(Output(UInt(16.W)))
val flt = IO(Input(Vec(2, Bool())))
2024-06-14 19:00:41 +08:00
val v24Det = IO(Input(Bool()))
2024-06-28 14:44:04 +08:00
val LED_ERR = IO(Output(Bool()))
2024-06-11 18:29:02 +08:00
val outReg = RegInit(0.U(16.W))
2024-06-28 14:44:04 +08:00
LED_ERR := v24Det
2024-06-11 18:29:02 +08:00
when( isCrcPass & downRegTemp(0)(3,0) === 0.U ){
2024-09-05 15:17:20 +08:00
outReg := Cat(downRegTemp(13), downRegTemp(12))
2024-06-11 18:29:02 +08:00
}
2024-09-05 15:17:20 +08:00
when( isCrcPass & downRegTemp(0)(3,0) === 0.U ){
mthodReg := Cat(downRegTemp(9), downRegTemp(8))
valueReg := Cat(downRegTemp(11), downRegTemp(10))
2024-06-11 18:29:02 +08:00
}
outRegSync := RegEnable( outReg, 0.U, isUpdate )
when( statusPage === 0.U ){
2024-09-02 17:46:14 +08:00
upReg(2) := Cat( 0.U(7.W), ~v24Det )
upReg(3) := 0.U
upReg(4) := Cat( 0.U(7.W), ~flt(0) )
upReg(5) := 0.U
upReg(6) := Cat( 0.U(7.W), ~flt(1) )
upReg(7) := 0.U
upReg(8) := mthodReg(7,0)
upReg(9) := mthodReg(15,8)
upReg(10) := valueReg(7,0)
upReg(11) := valueReg(15,8)
2024-06-11 18:29:02 +08:00
2024-09-02 17:46:14 +08:00
upReg(12) := outReg(7,0)
upReg(13) := outReg(15,8)
2024-06-11 18:29:02 +08:00
}
out := outPin
}