From 19fda05fbab2f1ae7b45984bbcc6452428549c11 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Fri, 3 Nov 2023 14:52:01 -0700 Subject: [PATCH] Revert GCD BB changes | Move GCD to 0x4000 to not conflict w/ bootrom --- common.mk | 1 - .../chipyard/src/main/scala/example/GCD.scala | 31 +++++-------------- tests/gcd.c | 8 ++--- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/common.mk b/common.mk index d5efb31a8e..f6bc19c141 100644 --- a/common.mk +++ b/common.mk @@ -246,7 +246,6 @@ $(SFC_MFC_TARGETS) &: $(TAPEOUT_CLASSPATH_TARGETS) $(FIRRTL_FILE) $(FINAL_ANNO_F @if [ $(shell cat $(SFC_LEVEL)) = low ]; then cat $(TMP_DIR)/unnec-anno-deleted2.sfc.anno.json > $(SFC_ANNO_FILE) && rm $(TMP_DIR)/unnec-anno-deleted.sfc.anno.json && rm $(TMP_DIR)/unnec-anno-deleted2.sfc.anno.json; fi firtool \ --format=fir \ - --dedup \ --export-module-hierarchy \ --verify-each=true \ --warn-on-unprocessed-annotations \ diff --git a/generators/chipyard/src/main/scala/example/GCD.scala b/generators/chipyard/src/main/scala/example/GCD.scala index b6102b44ab..ae1d49ddec 100644 --- a/generators/chipyard/src/main/scala/example/GCD.scala +++ b/generators/chipyard/src/main/scala/example/GCD.scala @@ -13,7 +13,7 @@ import freechips.rocketchip.util.UIntIsOneOf // DOC include start: GCD params case class GCDParams( - address: BigInt = 0x1000, + address: BigInt = 0x4000, width: Int = 32, useAXI4: Boolean = false, useBlackBox: Boolean = true) @@ -46,11 +46,10 @@ trait HasGCDIO extends BaseModule { } // DOC include start: GCD blackbox -class GCDMMIOBlackBox(val w: Int) extends BlackBox(Map("WIDTH" -> IntParam(w))) with HasBlackBoxPath +class GCDMMIOBlackBox(val w: Int) extends BlackBox(Map("WIDTH" -> IntParam(w))) with HasBlackBoxResource with HasGCDIO { - val chipyardDir = System.getProperty("user.dir") - addPath(s"$chipyardDir/generators/chipyard/src/main/resources/vsrc/GCDMMIOBlackBox.v") + addResource("/vsrc/GCDMMIOBlackBox.v") } // DOC include end: GCD blackbox @@ -114,36 +113,20 @@ trait GCDModule extends HasRegMap { Module(new GCDMMIOChiselModule(params.width)) } - val impl1 = if (params.useBlackBox) { - Module(new GCDMMIOBlackBox(params.width)) - } else { - Module(new GCDMMIOChiselModule(params.width)) - } - - impl.io.clock := clock impl.io.reset := reset.asBool impl.io.x := x impl.io.y := y.bits impl.io.input_valid := y.valid - y.ready := impl.io.input_ready && impl1.io.input_ready + y.ready := impl.io.input_ready gcd.bits := impl.io.gcd - gcd.valid := impl.io.output_valid && impl1.io.output_valid + gcd.valid := impl.io.output_valid impl.io.output_ready := gcd.ready - status := Cat(impl.io.input_ready, impl.io.output_valid, impl1.io.input_ready, impl1.io.output_valid) - io.gcd_busy := impl.io.busy && impl1.io.busy - - impl1.io.clock := clock - impl1.io.reset := reset.asBool - - impl1.io.x := x - impl1.io.y := y.bits - impl1.io.input_valid := y.valid - - impl1.io.output_ready := gcd.ready + status := Cat(impl.io.input_ready, impl.io.output_valid) + io.gcd_busy := impl.io.busy regmap( 0x00 -> Seq( diff --git a/tests/gcd.c b/tests/gcd.c index 1d8ee691b6..de28251d92 100644 --- a/tests/gcd.c +++ b/tests/gcd.c @@ -1,9 +1,9 @@ #include "mmio.h" -#define GCD_STATUS 0x1000 -#define GCD_X 0x1004 -#define GCD_Y 0x1008 -#define GCD_GCD 0x100C +#define GCD_STATUS 0x4000 +#define GCD_X 0x4004 +#define GCD_Y 0x4008 +#define GCD_GCD 0x400C unsigned int gcd_ref(unsigned int x, unsigned int y) { while (y != 0) {