Skip to content

Commit

Permalink
FpuPacker now use Uop spec completion service
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Apr 26, 2024
1 parent 7d03687 commit 1b97538
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/main/scala/vexiiriscv/execute/fpu/FpuPackerPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class FpuPackerPort(_cmd : FpuPackerCmd) extends Area{
}

class FpuPackerPlugin(val lane: ExecuteLanePlugin,
var wbAt : Int = 3) extends FiberPlugin with CompletionService with RegFileWriterService {
var wbAt : Int = 3) extends FiberPlugin with RegFileWriterService {
val p = FpuUtils


override def getCompletions(): Seq[Flow[CompletionPayload]] = List(logic.completion)
// override def getCompletions(): Seq[Flow[CompletionPayload]] = List(logic.completion)
override def getRegFileWriters(): Seq[Flow[RegFileWriter]] = List(logic.s3.fpWriter)

val elaborationLock = Retainer()
Expand All @@ -55,7 +55,6 @@ class FpuPackerPlugin(val lane: ExecuteLanePlugin,

elaborationLock.await()

val completion = Flow(CompletionPayload())
val wbPorts = mutable.LinkedHashMap[Int, Flow[Bits]]()
val uopsAt = mutable.LinkedHashMap[Int, ArrayBuffer[UopLayerSpec]]()
for(port <- ports; (uop, at) <- port.uopsAt) uopsAt.getOrElseUpdate(at, ArrayBuffer[UopLayerSpec]()) += uop
Expand All @@ -65,6 +64,7 @@ class FpuPackerPlugin(val lane: ExecuteLanePlugin,
wbPorts(at) = port
for(uop <- uops) {
wbp.addMicroOp(port, uop)
uop.setCompletion(at+latency)
uop.reserve(FpuPackerPlugin.this, at)
ffwbp.addUop(flagsWb, uop, at+latency)
}
Expand Down Expand Up @@ -237,14 +237,9 @@ class FpuPackerPlugin(val lane: ExecuteLanePlugin,
port.valid := GROUP_OH(i)
port.payload := fwb.value
}
completion.valid := valid && GROUP_OH.orR
completion.hartId := Global.HART_ID
completion.uopId := Decode.UOP_ID
completion.trap := False
completion.commit := True

val fpWriter = Flow(RegFileWriter(FloatRegFile))
fpWriter.valid := completion.valid
fpWriter.valid := GROUP_OH.orR && valid
fpWriter.data := fwb.value
fpWriter.uopId := Decode.UOP_ID

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/vexiiriscv/regfile/RegFilePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class RegFilePlugin(var spec : RegfileSpec,
when(!done) {
port.valid := True
port.address := counter.resized
port.data := 0
port.data := spec.initialValue
counter := counter + 1
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/vexiiriscv/riscv/MicroOp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ trait RegfileSpec extends Nameable{
def width : Int
def x0AlwaysZero : Boolean
def getName() : String
def initialValue : BigInt

def ->(access : RfAccess) = RfResource(this, access)
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/vexiiriscv/riscv/RegFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object IntRegFile extends RegfileSpec with AreaObject {
override def width = Riscv.XLEN
override def x0AlwaysZero = true
override def getName() = "integer"
override def initialValue: BigInt = 0

def TypeR(key : MaskedLiteral) = SingleDecoding(
key = key,
Expand Down Expand Up @@ -65,6 +66,7 @@ object FloatRegFile extends RegfileSpec with AreaObject {
override def width = if(Riscv.RVD) 64 else 32
override def x0AlwaysZero = false
override def getName() = "float"
override def initialValue: BigInt = 0 //if(Riscv.RVD) 0x7FF8000000000000l else 0x7fc00000l

def TypeR(key : MaskedLiteral) = SingleDecoding(
key = key,
Expand Down

0 comments on commit 1b97538

Please sign in to comment.