Skip to content

Commit

Permalink
[doc] more draft for uop
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-Wye committed Jun 11, 2024
1 parent 705c0c8 commit 6e1c799
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 9 deletions.
11 changes: 4 additions & 7 deletions t1/src/decoder/attribute/fpExecutionType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ object FpExecutionType {
trait Type extends Uop {
def apply(t1DecodePattern: T1DecodePattern): Boolean
}
case object Div extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = ???
}
case object Compare extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = ???
def apply(t1DecodePattern: T1DecodePattern): Boolean = isFcompare(this)
}
case object Other extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = ???
def apply(t1DecodePattern: T1DecodePattern): Boolean = isFother(this)
}
case object MA extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = ???
def apply(t1DecodePattern: T1DecodePattern): Boolean = false
}
case object Nil extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = {
Expand All @@ -28,7 +25,7 @@ object FpExecutionType {
}
}
def apply(t1DecodePattern: T1DecodePattern): Type = {
val tpe = Seq(Div, Compare, Other, MA).filter(tpe =>
val tpe = Seq(Compare, Other, MA).filter(tpe =>
tpe(t1DecodePattern)
)
require(tpe.size <= 1)
Expand Down
4 changes: 2 additions & 2 deletions t1/src/decoder/attribute/topUop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ object TopUop {
def apply(t1DecodePattern: T1DecodePattern): Boolean
}
case object SILD extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = ???
def apply(t1DecodePattern: T1DecodePattern): Boolean = isSlid(this)
}
case object EXTEND extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = ???
def apply(t1DecodePattern: T1DecodePattern): Boolean = isExtend(this)
}
case object Nil extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = {
Expand Down
56 changes: 56 additions & 0 deletions t1/src/decoder/attribute/uop.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 Jiuyang Liu <[email protected]>

package org.chipsalliance.t1.rtl.decoder.attribute

import org.chipsalliance.t1.rtl.decoder.T1DecodePattern

object DecoderUop {
trait Type extends Uop {
def apply(t1DecodePattern: T1DecodePattern): Boolean
}
case object FLOAT extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isFloat(this) && (isFma(this) || isFcompare(this) || isFother(this))
}
case object MULTIPLIER extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isMultiplier(this)
// TODO: need new attribute
}
case object DIVIDER extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isDivider(this)
// TODO: need new attribute
}
case object ADDER extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isAdder(this)
// TODO: need new attribute
}
case object LOGIC extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isLogic(this)
// TODO: need new attribute
}
case object SHIFT extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isShift(this)
// TODO: need new attribute
}
case object OTHER extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = isOther(this)
}

case object Nil extends Type {
def apply(t1DecodePattern: T1DecodePattern): Boolean = {
require(requirement = false, "unreachable")
false
}
}
def apply(t1DecodePattern: T1DecodePattern): Type = {
val tpe = Seq(FLOAT, MULTIPLIER, DIVIDER, ADDER, LOGIC, SHIFT, OTHER).filter(tpe =>
tpe(t1DecodePattern)
)
require(tpe.size <= 1)
tpe.headOption.getOrElse(Nil)
}
}

case class DecoderUop(value: TopUop.Type) extends UopDecodeAttribute[TopUop.Type] {
override val description: String = "uop for mask unit."
}

0 comments on commit 6e1c799

Please sign in to comment.