Skip to content
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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions t1/src/zvma/ZVMA.scala
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)
Comment on lines +23 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline these to request

}

class ZVMAInstRequest(parameter: ZVMAParameter) extends Bundle {
val instruction: UInt = UInt(32.W)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need instruction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add index, the zvma will be dec at vector decode stage.

Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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)
}
Loading