From 6e1c7992ec745cdbfbe987f1d764aa1a7bc24835 Mon Sep 17 00:00:00 2001 From: Lucas-Wye Date: Tue, 11 Jun 2024 22:17:55 +0800 Subject: [PATCH] [doc] more draft for uop --- .../decoder/attribute/fpExecutionType.scala | 11 ++-- t1/src/decoder/attribute/topUop.scala | 4 +- t1/src/decoder/attribute/uop.scala | 56 +++++++++++++++++++ 3 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 t1/src/decoder/attribute/uop.scala diff --git a/t1/src/decoder/attribute/fpExecutionType.scala b/t1/src/decoder/attribute/fpExecutionType.scala index ee60e708d..7cca0f28d 100644 --- a/t1/src/decoder/attribute/fpExecutionType.scala +++ b/t1/src/decoder/attribute/fpExecutionType.scala @@ -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 = { @@ -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) diff --git a/t1/src/decoder/attribute/topUop.scala b/t1/src/decoder/attribute/topUop.scala index 0acad6b10..4ddcb07b8 100644 --- a/t1/src/decoder/attribute/topUop.scala +++ b/t1/src/decoder/attribute/topUop.scala @@ -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 = { diff --git a/t1/src/decoder/attribute/uop.scala b/t1/src/decoder/attribute/uop.scala new file mode 100644 index 000000000..3cd7f11b1 --- /dev/null +++ b/t1/src/decoder/attribute/uop.scala @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2022 Jiuyang Liu + +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." +}