Merge pull request #71 from ucb-bar/rebar_dev_hwacha

[rebar] adding Hwacha
This commit is contained in:
Abraham Gonzalez
2019-04-30 11:53:43 -07:00
committed by GitHub
8 changed files with 99 additions and 45 deletions

3
.gitmodules vendored
View File

@@ -28,3 +28,6 @@
[submodule "generators/sifive-blocks"] [submodule "generators/sifive-blocks"]
path = generators/sifive-blocks path = generators/sifive-blocks
url = git@github.com:sifive/sifive-blocks.git url = git@github.com:sifive/sifive-blocks.git
[submodule "generators/hwacha"]
path = generators/hwacha
url = git@github.com:ucb-bar/hwacha.git

View File

@@ -46,7 +46,11 @@ def conditionalDependsOn(prj: Project): Project = {
} }
lazy val example = conditionalDependsOn(project in file(".")) lazy val example = conditionalDependsOn(project in file("."))
.dependsOn(boom, sifive_blocks) .dependsOn(boom, hwacha, sifive_blocks)
.settings(commonSettings)
lazy val hwacha = (project in file ("generators/hwacha"))
.dependsOn(rebarrocketchip)
.settings(commonSettings) .settings(commonSettings)
lazy val boom = (project in file("generators/boom")) lazy val boom = (project in file("generators/boom"))

View File

@@ -8,7 +8,7 @@ SHELL=/bin/bash
######################################################################################### #########################################################################################
lookup_scala_srcs = $(shell find -L $(1)/ -iname "*.scala" 2> /dev/null) lookup_scala_srcs = $(shell find -L $(1)/ -iname "*.scala" 2> /dev/null)
PACKAGES=rocket-chip testchipip boom PACKAGES=rocket-chip testchipip boom hwacha sifive-blocks
SCALA_SOURCES=$(foreach pkg,$(PACKAGES),$(call lookup_scala_srcs,$(base_dir)/generators/$(pkg)/src/main/scala)) $(call lookup_scala_srcs,$(base_dir)/src/main/scala) SCALA_SOURCES=$(foreach pkg,$(PACKAGES),$(call lookup_scala_srcs,$(base_dir)/generators/$(pkg)/src/main/scala)) $(call lookup_scala_srcs,$(base_dir)/src/main/scala)
######################################################################################### #########################################################################################
@@ -41,7 +41,7 @@ CHISEL_ARGS ?=
$(FIRRTL_FILE) $(ANNO_FILE): $(SCALA_SOURCES) $(sim_dotf) $(FIRRTL_FILE) $(ANNO_FILE): $(SCALA_SOURCES) $(sim_dotf)
mkdir -p $(build_dir) mkdir -p $(build_dir)
cd $(base_dir) && $(SBT) "project $(SBT_PROJECT)" "runMain $(PROJECT).Generator $(CHISEL_ARGS) $(build_dir) $(PROJECT) $(MODEL) $(CFG_PROJECT) $(CONFIG)" cd $(base_dir) && $(SBT) "project $(SBT_PROJECT)" "runMain $(GENERATOR_PACKAGE).Generator $(CHISEL_ARGS) $(build_dir) $(MODEL_PACKAGE) $(MODEL) $(CONFIG_PACKAGE) $(CONFIG)"
######################################################################################### #########################################################################################
# create verilog files rules and variables # create verilog files rules and variables
@@ -78,7 +78,7 @@ $(output_dir)/%.run: $(output_dir)/% $(sim)
$(sim) +max-cycles=$(timeout_cycles) $< && touch $@ $(sim) +max-cycles=$(timeout_cycles) $< && touch $@
$(output_dir)/%.out: $(output_dir)/% $(sim) $(output_dir)/%.out: $(output_dir)/% $(sim)
$(sim) +verbose +max-cycles=$(timeout_cycles) $< 3>&1 1>&2 2>&3 | spike-dasm > $@ $(sim) +permissive +verbose +max-cycles=$(timeout_cycles) +permissive-off $< 3>&1 1>&2 2>&3 | spike-dasm > $@
######################################################################################### #########################################################################################
# include build/project specific makefrags made from the generator # include build/project specific makefrags made from the generator

1
generators/hwacha Submodule

Submodule generators/hwacha added at bc89157b28

View File

@@ -22,8 +22,8 @@ sim_name = verilator
# vcs simulator types and rules # vcs simulator types and rules
######################################################################################### #########################################################################################
sim_prefix = simulator sim_prefix = simulator
sim = $(sim_dir)/$(sim_prefix)-$(PROJECT)-$(CONFIG) sim = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)
sim_debug = $(sim_dir)/$(sim_prefix)-$(PROJECT)-$(CONFIG)-debug sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug
.PHONY: default debug .PHONY: default debug
default: $(sim) default: $(sim)
@@ -78,7 +78,7 @@ $(sim_debug): $(model_mk_debug)
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk $(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk
######################################################################################### #########################################################################################
# create a vcs vpd rule # create a verisim vpd rule
######################################################################################### #########################################################################################
$(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug)
rm -f $@.vcd && mkfifo $@.vcd rm -f $@.vcd && mkfifo $@.vcd

View File

@@ -22,8 +22,8 @@ sim_name = vcs
# vcs simulator types and rules # vcs simulator types and rules
######################################################################################### #########################################################################################
sim_prefix = simv sim_prefix = simv
sim = $(sim_dir)/$(sim_prefix)-$(PROJECT)-$(CONFIG) sim = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)
sim_debug = $(sim_dir)/$(sim_prefix)-$(PROJECT)-$(CONFIG)-debug sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug
.PHONY: default debug .PHONY: default debug
default: $(sim) default: $(sim)

View File

@@ -17,6 +17,10 @@ class DefaultRocketConfig extends Config(
new WithNormalRocketTop ++ new WithNormalRocketTop ++
new BaseRocketConfig) new BaseRocketConfig)
class HwachaConfig extends Config(
new hwacha.DefaultHwachaConfig ++
new DefaultRocketConfig)
class RoccRocketConfig extends Config( class RoccRocketConfig extends Config(
new WithRoccExample ++ new WithRoccExample ++
new DefaultRocketConfig) new DefaultRocketConfig)
@@ -64,6 +68,10 @@ class DefaultBoomConfig extends Config(
new WithNormalBoomTop ++ new WithNormalBoomTop ++
new BaseBoomConfig) new BaseBoomConfig)
class HwachaBoomConfig extends Config(
new hwacha.DefaultHwachaConfig ++
new DefaultBoomConfig)
class RoccBoomConfig extends Config( class RoccBoomConfig extends Config(
new WithRoccExample ++ new WithRoccExample ++
new DefaultBoomConfig) new DefaultBoomConfig)

View File

@@ -3,53 +3,88 @@
######################################################################################### #########################################################################################
######################################################################################### #########################################################################################
# default variables to invoke the generator for a example Rocket system # variables to invoke the generator
# descriptions: # descriptions:
# PROJECT = the scala package to find the MODEL/Generator in # SBT_PROJECT = the SBT project that you should find the classes/packages in
# MODEL = the top level module of the project in Chisel (normally the harness) # MODEL = the top level module of the project in Chisel (normally the harness)
# VLOG_MODEL = the top level module of the project in Firrtl/Verilog (normally the harness) # VLOG_MODEL = the top level module of the project in Firrtl/Verilog (normally the harness)
# MODEL_PACKAGE = the scala package to find the MODEL in
# CONFIG = the configuration class to give the parameters for the project # CONFIG = the configuration class to give the parameters for the project
# CFG_PROJECT = the scala package to find the CONFIG class # CONFIG_PACKAGE = the scala package to find the CONFIG class
# SBT_PROJECT = the SBT project that you should find the Generator class in # GENERATOR_PACKAGE = the scala package to find the Generator class in
# TB = wrapper over the TestHarness needed to simulate in VCS # TB = wrapper over the TestHarness needed to simulate in a verilog simulator
# TOP = top level module of the project (normally the module instantiated by the harness) # TOP = top level module of the project (normally the module instantiated by the harness)
# #
# project specific: # project specific:
# SUB_PROJECT = use the specific subproject default variables # SUB_PROJECT = use the specific subproject default variables
######################################################################################### #########################################################################################
PROJECT ?= example
MODEL ?= RocketTestHarness
VLOG_MODEL ?= TestHarness
CONFIG ?= DefaultRocketConfig
CFG_PROJECT ?= $(PROJECT)
SBT_PROJECT ?= $(PROJECT)
TB ?= TestDriver
TOP ?= RocketTop
# make it so that you only change 1 param to change most or all of them! #########################################################################################
# subproject overrides
# description:
# - make it so that you only change 1 param to change most or all of them!
# - mainly intended for quick developer setup for common flags
#########################################################################################
SUB_PROJECT ?= example SUB_PROJECT ?= example
ifeq ($(SUB_PROJECT),example)
SBT_PROJECT ?= example
MODEL ?= RocketTestHarness
VLOG_MODEL ?= TestHarness
MODEL_PACKAGE ?= $(SBT_PROJECT)
CONFIG ?= DefaultRocketConfig
CONFIG_PACKAGE ?= $(SBT_PROJECT)
GENERATOR_PACKAGE ?= $(SBT_PROJECT)
TB ?= TestDriver
TOP ?= RocketTop
endif
# for a BOOM based example system
ifeq ($(SUB_PROJECT),boomexample) ifeq ($(SUB_PROJECT),boomexample)
# for a BOOM based system (provides all necessary params) SBT_PROJECT ?= example
MODEL=BoomTestHarness MODEL ?= BoomTestHarness
CONFIG=DefaultBoomConfig VLOG_MODEL ?= TestHarness
TOP=BoomTop MODEL_PACKAGE ?= $(SBT_PROJECT)
CONFIG ?= DefaultBoomConfig
CONFIG_PACKAGE ?= $(SBT_PROJECT)
GENERATOR_PACKAGE ?= $(SBT_PROJECT)
TB ?= TestDriver
TOP ?= BoomTop
endif endif
# for BOOM developers
ifeq ($(SUB_PROJECT),boom) ifeq ($(SUB_PROJECT),boom)
# for BOOM developers (only need to provide a CONFIG) SBT_PROJECT ?= boom
PROJECT=boom.system MODEL ?= TestHarness
MODEL=TestHarness VLOG_MODEL ?= TestHarness
CFG_PROJECT=boom.system MODEL_PACKAGE ?= boom.system
SBT_PROJECT=boom CONFIG ?= BoomConfig
TOP=ExampleBoomSystem CONFIG_PACKAGE ?= boom.system
GENERATOR_PACKAGE ?= boom.system
TB ?= TestDriver
TOP ?= ExampleBoomSystem
endif endif
# for Rocket-chip developers
ifeq ($(SUB_PROJECT),rocketchip) ifeq ($(SUB_PROJECT),rocketchip)
# for Rocket-chip developers SBT_PROJECT ?= rebarrocketchip
PROJECT=freechips.rocketchip.system MODEL ?= TestHarness
MODEL=TestHarness VLOG_MODEL ?= TestHarness
CONFIG=DefaultConfig MODEL_PACKAGE ?= freechips.rocketchip.system
CFG_PROJECT=freechips.rocketchip.system CONFIG ?= DefaultConfig
SBT_PROJECT=rebarrocketchip CONFIG_PACKAGE ?= freechips.rocketchip.system
TOP=ExampleRocketSystem GENERATOR_PACKAGE ?= freechips.rocketchip.system
TB ?= TestDriver
TOP ?= ExampleRocketSystem
endif
# for Hwacha developers
ifeq ($(SUB_PROJECT),hwacha)
SBT_PROJECT ?= hwacha
MODEL ?= TestHarness
VLOG_MODEL ?= TestHarness
MODEL_PACKAGE ?= freechips.rocketchip.system
CONFIG ?= HwachaConfig
CONFIG_PACKAGE ?= hwacha
GENERATOR_PACKAGE ?= hwacha
TB ?= TestDriver
TOP ?= ExampleRocketSystem
endif endif
######################################################################################### #########################################################################################
@@ -62,11 +97,14 @@ REBAR_FIRRTL_DIR = $(base_dir)/tools/firrtl
######################################################################################### #########################################################################################
# names of various files needed to compile and run things # names of various files needed to compile and run things
######################################################################################### #########################################################################################
long_name = $(PROJECT).$(MODEL).$(CONFIG) long_name = $(MODEL_PACKAGE).$(MODEL).$(CONFIG)
# if building from rocketchip, override the long_name to match what they expect # match the long_name to what the specific generator will output
ifeq ($(SBT_PROJECT),rebarrocketchip) ifeq ($(GENERATOR_PACKAGE),freechips.rocketchip.system)
long_name=$(PROJECT).$(CONFIG) long_name=$(CONFIG_PACKAGE).$(CONFIG)
endif
ifeq ($(GENERATOR_PACKAGE),hwacha)
long_name=$(MODEL_PACKAGE).$(CONFIG)
endif endif
FIRRTL_FILE ?= $(build_dir)/$(long_name).fir FIRRTL_FILE ?= $(build_dir)/$(long_name).fir
@@ -100,7 +138,7 @@ output_dir=$(sim_dir)/output
######################################################################################### #########################################################################################
# build output directory for compilation # build output directory for compilation
######################################################################################### #########################################################################################
build_dir=$(sim_dir)/generated-src build_dir=$(sim_dir)/generated-src/$(long_name)
######################################################################################### #########################################################################################
# vsrcs needed to run projects # vsrcs needed to run projects