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

75 lines
1.6 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 ){
outReg := Cat(downRegTemp(3), downRegTemp(2))
}
when( isCrcPass & downRegTemp(0)(3,0) === 1.U & downRegTemp(2).extract(0) ){
mthodReg := Cat(downRegTemp(3), downRegTemp(2))
valueReg := Cat(downRegTemp(5), downRegTemp(4))
}
outRegSync := RegEnable( outReg, 0.U, isUpdate )
when( statusPage === 0.U ){
upReg(2) := outReg(7,0)
upReg(3) := outReg(15,8)
upReg(4) := Cat( ~flt(1), ~flt(0) )
2024-06-14 19:00:41 +08:00
upReg(5) := Cat( ~v24Det, 0.U(7.W) )
2024-06-11 18:29:02 +08:00
}
when( statusPage === 1.U ){
upReg(2) := RegEnable(downRegTemp(2).extract(0), isCrcPass & downRegTemp(0)(3,0) === 1.U)
upReg(4) := mthodReg(7,0)
upReg(5) := mthodReg(15,8)
upReg(6) := valueReg(7,0)
upReg(7) := valueReg(15,8)
}
2024-09-02 16:24:02 +08:00
val page15reg2 := 6.U
val page15reg3 := 0.U
val page15reg4 := 4.U
val page15reg5 := 2.U
val page15reg6 := 0.U
val page15reg7 := 0.U
val page15reg8 := 0.U
val page15reg9 := 0.U
2024-06-11 18:29:02 +08:00
out := outPin
}