-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rtl] add zvma. #957
base: master
Are you sure you want to change the base?
[rtl] add zvma. #957
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.chipsalliance.t1.rtl.zvma | ||
|
||
import chisel3.experimental.{SerializableModule, SerializableModuleParameter} | ||
import chisel3.util._ | ||
import chisel3._ | ||
|
||
object ZVMAParameter { | ||
implicit def rw: upickle.default.ReadWriter[ZVMAParameter] = upickle.default.macroRW | ||
} | ||
|
||
case class ZVMAParameter( | ||
vlen: Int, | ||
dlen: Int, | ||
TE: Int | ||
) extends SerializableModuleParameter { | ||
val tmWidth: Int = log2Ceil(TE + 1) | ||
val tnWidth: Int = log2Ceil(vlen + 1) | ||
|
||
val dataIndexBit: Int = log2Ceil(vlen * 8 / dlen + 1) | ||
} | ||
|
||
class ZVMCsrInterface(parameter: ZVMAParameter) extends Bundle { | ||
// TEW = SEW * TWIDEN | ||
val tew = UInt(3.W) | ||
// tk can hold values from 0-4, inclusive. | ||
val tk = UInt(3.W) | ||
// tm can hold values from 0-TE, inclusive. | ||
val tm = UInt(parameter.tmWidth.W) | ||
val tn = UInt(parameter.tnWidth.W) | ||
} | ||
|
||
class ZVMAInstRequest(parameter: ZVMAParameter) extends Bundle { | ||
val instruction: UInt = UInt(32.W) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need instruction. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add index, the zvma will be dec at vector decode stage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Require should contain all metadata that required by zmva block |
||
val csr = new ZVMCsrInterface(parameter) | ||
} | ||
|
||
class ZVMADataChannel(parameter: ZVMAParameter) extends Bundle { | ||
// The data will be converted into segment format in lsu | ||
val data: UInt = UInt(parameter.dlen.W) | ||
|
||
val index: UInt = UInt(parameter.dataIndexBit.W) | ||
} | ||
|
||
class ZVMAInterface(parameter: ZVMAParameter) extends Bundle { | ||
val clock = Input(Clock()) | ||
val reset = Input(Reset()) | ||
val request: ValidIO[ZVMAInstRequest] = Flipped(Valid(new ZVMAInstRequest(parameter))) | ||
val dataFromLSU: ValidIO[ZVMADataChannel] = Flipped(Valid(new ZVMADataChannel(parameter))) | ||
val dataToLSU: DecoupledIO[ZVMADataChannel] = Decoupled(new ZVMADataChannel(parameter)) | ||
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Read/Write Channel not only for LSU, but operand |
||
val idle: Bool = Output(Bool()) | ||
} | ||
|
||
class ZVMA(val parameter: ZVMAParameter) | ||
extends FixedIORawModule(new ZVMAInterface(parameter)) | ||
with SerializableModule[ZVMAParameter] | ||
with ImplicitClock | ||
with ImplicitReset { | ||
protected def implicitClock = io.clock | ||
protected def implicitReset = io.reset | ||
|
||
val instReg: ZVMAInstRequest = RegEnable(io.request.bits, 0.U.asTypeOf(io.request.bits), io.request.fire) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline these to request