From ac124e7e652ed671f089c277816e40979ac1e42b Mon Sep 17 00:00:00 2001 From: Jiuyang Liu Date: Fri, 13 Dec 2024 10:59:45 +0800 Subject: [PATCH] [om] retime FloatAdder in Permutation --- omreaderlib/src/t1/T1.scala | 11 ++++++++++- omreaderlib/src/t1rocketv/T1RocketTile.scala | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/omreaderlib/src/t1/T1.scala b/omreaderlib/src/t1/T1.scala index 5e040886e..2c7ee4666 100644 --- a/omreaderlib/src/t1/T1.scala +++ b/omreaderlib/src/t1/T1.scala @@ -18,6 +18,15 @@ class T1(val mlirbc: Array[Byte]) extends T1OMReaderAPI { def instructions: Seq[Instruction] = t1("decoder").obj("instructions").list.elements().map(_.obj).map(getInstruction) def sram: Seq[SRAM] = t1("lanes").list.elements().map(_.obj("vrf").obj).flatMap(getSRAM) - def retime: Seq[Retime] = + + def floatAdder = { + val reduceUnit = t1("permutatuon").obj("reduceUnit").obj + // TODO: need fieldOpt(name: String) + Option.when(reduceUnit.fieldNames().contains("floatAdder"))(reduceUnit("floatAdder").obj).flatMap(getRetime) + } + + def vfus: Seq[Retime] = t1("lanes").list.elements().map(_.obj("vfus")).flatMap(_.list.elements().map(_.obj)).flatMap(getRetime) + + def retime = (vfus ++ floatAdder).distinct } diff --git a/omreaderlib/src/t1rocketv/T1RocketTile.scala b/omreaderlib/src/t1rocketv/T1RocketTile.scala index 1224726e4..3187adec6 100644 --- a/omreaderlib/src/t1rocketv/T1RocketTile.scala +++ b/omreaderlib/src/t1rocketv/T1RocketTile.scala @@ -22,6 +22,12 @@ class T1RocketTile(val mlirbc: Array[Byte]) extends T1OMReaderAPI { Seq(tile("frontend").obj("icache").obj, tile("hellaCache").obj).flatMap(getSRAM) def vfu: Seq[Retime] = t1("lanes").list.elements().map(_.obj("vfus")).flatMap(_.list.elements().map(_.obj)).flatMap(getRetime) - def retime = vfu + def floatAdder = { + val reduceUnit = t1("permutatuon").obj("reduceUnit").obj + // TODO: need fieldOpt(name: String) + Option.when(reduceUnit.fieldNames().contains("floatAdder"))(reduceUnit("floatAdder").obj).flatMap(getRetime) + } + + def retime = (vfu ++ floatAdder).distinct def sram = vrf ++ cache }