-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | ||
} |