-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (24 loc) · 965 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
JOBS = 16
TOP_MODULE_PROJECT ?= thinpad
TOP_MODULE ?= RocketChip
CONFIG ?= ThinpadFPGAConfig
BASE_DIR = $(abspath .)
BUILD = $(BASE_DIR)/build
SRC = $(BASE_DIR)/src
SHELL := /bin/bash
SBT ?= sbt
all: $(BUILD)/$(TOP_MODULE_PROJECT).$(CONFIG).v
CHISEL_ARGS := $(BUILD)
LOOKUP_SCALA_SRCS = $(shell find $(1)/. -iname "*.scala" 2> /dev/null)
BOOTROM := $(shell find bootrom -iname "*.img" 2> /dev/null)
$(BUILD)/$(TOP_MODULE_PROJECT).$(CONFIG).fir: $(call LOOKUP_SCALA_SRCS,$(SRC)) $(BOOTROM)
mkdir -p $(@D)
$(SBT) "runMain freechips.rocketchip.system.Generator $(CHISEL_ARGS) $(TOP_MODULE_PROJECT) $(TOP_MODULE) $(TOP_MODULE_PROJECT) $(CONFIG)"
$(BUILD)/$(TOP_MODULE_PROJECT).$(CONFIG).v: $(BUILD)/$(TOP_MODULE_PROJECT).$(CONFIG).fir
$(SBT) "runMain firrtl.stage.FirrtlMain -i $< -o $@ -X verilog"
cp $@ [email protected]
cp prologue.v $@
sed 's/wire \[..:0\] coreMonitorBundle/(* mark_debug="true" *) \0/g' [email protected] >> $@
clean:
rm -rf build/*
.PHONY: all clean