Revert GCD BB changes | Move GCD to 0x4000 to not conflict w/ bootrom

This commit is contained in:
abejgonzalez
2023-11-03 14:52:01 -07:00
parent d7f78ba2e4
commit 19fda05fba
3 changed files with 11 additions and 29 deletions

View File

@@ -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 @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 \ firtool \
--format=fir \ --format=fir \
--dedup \
--export-module-hierarchy \ --export-module-hierarchy \
--verify-each=true \ --verify-each=true \
--warn-on-unprocessed-annotations \ --warn-on-unprocessed-annotations \

View File

@@ -13,7 +13,7 @@ import freechips.rocketchip.util.UIntIsOneOf
// DOC include start: GCD params // DOC include start: GCD params
case class GCDParams( case class GCDParams(
address: BigInt = 0x1000, address: BigInt = 0x4000,
width: Int = 32, width: Int = 32,
useAXI4: Boolean = false, useAXI4: Boolean = false,
useBlackBox: Boolean = true) useBlackBox: Boolean = true)
@@ -46,11 +46,10 @@ trait HasGCDIO extends BaseModule {
} }
// DOC include start: GCD blackbox // 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 with HasGCDIO
{ {
val chipyardDir = System.getProperty("user.dir") addResource("/vsrc/GCDMMIOBlackBox.v")
addPath(s"$chipyardDir/generators/chipyard/src/main/resources/vsrc/GCDMMIOBlackBox.v")
} }
// DOC include end: GCD blackbox // DOC include end: GCD blackbox
@@ -114,36 +113,20 @@ trait GCDModule extends HasRegMap {
Module(new GCDMMIOChiselModule(params.width)) 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.clock := clock
impl.io.reset := reset.asBool impl.io.reset := reset.asBool
impl.io.x := x impl.io.x := x
impl.io.y := y.bits impl.io.y := y.bits
impl.io.input_valid := y.valid 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.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 impl.io.output_ready := gcd.ready
status := Cat(impl.io.input_ready, impl.io.output_valid, impl1.io.input_ready, impl1.io.output_valid) status := Cat(impl.io.input_ready, impl.io.output_valid)
io.gcd_busy := impl.io.busy && impl1.io.busy io.gcd_busy := impl.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
regmap( regmap(
0x00 -> Seq( 0x00 -> Seq(

View File

@@ -1,9 +1,9 @@
#include "mmio.h" #include "mmio.h"
#define GCD_STATUS 0x1000 #define GCD_STATUS 0x4000
#define GCD_X 0x1004 #define GCD_X 0x4004
#define GCD_Y 0x1008 #define GCD_Y 0x4008
#define GCD_GCD 0x100C #define GCD_GCD 0x400C
unsigned int gcd_ref(unsigned int x, unsigned int y) { unsigned int gcd_ref(unsigned int x, unsigned int y) {
while (y != 0) { while (y != 0) {