-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bump-rocket' into 'master'
Bump rocket See merge request pard/labeled-RISC-V!230
- Loading branch information
Showing
177 changed files
with
6,851 additions
and
1,933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule chisel3
updated
from 3d8064 to 9a0ce2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,11 @@ verilog = \ | |
$(generated_dir)/$(long_name).v \ | ||
$(generated_dir)/$(long_name).behav_srams.v \ | ||
|
||
.SECONDARY: $(firrtl) $(verilog) | ||
origin_verilog = \ | ||
$(generated_dir)/$(long_name).v \ | ||
$(generated_dir)/$(long_name).origin_behav_srams.v \ | ||
|
||
.SECONDARY: $(firrtl) $(verilog) $(origin_verilog) | ||
|
||
$(generated_dir)/%.fir $(generated_dir)/%.d: $(FIRRTL_JAR) $(chisel_srcs) $(bootrom_img) | ||
mkdir -p $(dir $@) | ||
|
@@ -24,8 +28,12 @@ $(generated_dir)/$(long_name).behav_srams.v : $(generated_dir)/$(long_name).conf | |
$(mem_init) [email protected] mem_ext bin.txt $(generated_dir)/$(long_name).json > $@ | ||
rm -f [email protected] | ||
|
||
$(generated_dir)/$(long_name).origin_behav_srams.v : $(generated_dir)/$(long_name).conf $(VLSI_MEM_GEN) | ||
cd $(generated_dir) && \ | ||
$(VLSI_MEM_GEN) $(generated_dir)/$(long_name).conf > $@ | ||
|
||
# Build and install our own Verilator, to work around versionining issues. | ||
VERILATOR_VERSION=4.004 | ||
VERILATOR_VERSION=4.008 | ||
VERILATOR_SRCDIR ?= verilator/src/verilator-$(VERILATOR_VERSION) | ||
VERILATOR_TARGET := $(abspath verilator/install/bin/verilator) | ||
INSTALLED_VERILATOR ?= $(VERILATOR_TARGET) | ||
|
@@ -55,13 +63,14 @@ verilator: $(INSTALLED_VERILATOR) | |
|
||
# Run Verilator to produce a fast binary to emulate this circuit. | ||
VERILATOR := $(INSTALLED_VERILATOR) --cc --exe | ||
VERILATOR_THREADS ?= 2 | ||
VERILATOR_FLAGS := --top-module $(MODEL) \ | ||
+define+PRINTF_COND=\$$c\(\"verbose\",\"\&\&\"\,\"done_reset\"\) \ | ||
+define+RANDOMIZE_GARBAGE_ASSIGN \ | ||
+define+STOP_COND=\$$c\(\"done_reset\"\) --assert \ | ||
--output-split 20000 \ | ||
--output-split-cfuncs 20000 \ | ||
--threads 4 \ | ||
--threads $(VERILATOR_THREADS) \ | ||
-Wno-STMTDLY --x-assign unique \ | ||
-I$(vsrc) \ | ||
-O3 -CFLAGS "$(CXXFLAGS) -DVERILATOR -DTEST_HARNESS=V$(MODEL) -include $(csrc)/verilator.h -include $(generated_dir)/$(PROJECT).$(CONFIG).plusArgs" | ||
|
@@ -84,3 +93,12 @@ $(emu_debug): $(verilog) $(cppfiles) $(headers) $(generated_dir)/$(long_name).d | |
-o $(abspath $(sim_dir))/$@ $(verilog) $(cppfiles) -LDFLAGS "$(LDFLAGS)" \ | ||
-CFLAGS "-I$(generated_dir_debug) -include $(model_header_debug)" | ||
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(generated_dir_debug)/$(long_name) -f V$(MODEL).mk | ||
|
||
$(origin_emu): $(origin_verilog) $(cppfiles) $(headers) $(INSTALLED_VERILATOR) | ||
mkdir -p $(generated_dir)/$(long_name) | ||
$(VERILATOR) $(VERILATOR_FLAGS) -Mdir $(generated_dir)/$(long_name) \ | ||
-o $(abspath $(sim_dir))/$@ $(origin_verilog) $(cppfiles) -LDFLAGS "$(LDFLAGS)" \ | ||
-CFLAGS "-I$(generated_dir) -include $(model_header)" | ||
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(generated_dir)/$(long_name) -f V$(MODEL).mk | ||
|
||
|
Submodule firrtl
updated
from 860e68 to 227204
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
BUILD_DIR=$1 | ||
|
||
for i in $(ls $1/c*.dtb) | ||
do | ||
sh gen_bin.sh $i $i.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ts | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import sh | ||
import os | ||
import errno | ||
from pathlib import Path | ||
import binascii as ba | ||
from os.path import join as pjoin | ||
|
||
|
||
# hex_dump == hexdump -ve '2/ "%08x " "\n"' $1 | awk '{print $2$1}' > $2 | ||
def hex_dump(in_file, out_file): | ||
assert os.path.isfile(in_file) | ||
print(in_file) | ||
with open(in_file, 'rb') as f, open(out_file, 'w') as out_f: | ||
chunks = iter(lambda : f.read(1), b'') | ||
hex_bytes = map(ba.hexlify, chunks) | ||
|
||
buffer = [] | ||
for b in hex_bytes: | ||
buffer.append(b.decode()) | ||
if len(buffer) == 8: | ||
buffer.reverse() | ||
out_f.write(''.join(buffer) + '\n') | ||
buffer.clear() | ||
|
||
|
||
def safe_mkdir(dir: str): | ||
if not os.path.exists(dir): | ||
try: | ||
os.makedirs(dir) | ||
except OSError as e: | ||
# when another thread create this directory | ||
assert e.errno == errno.EEXIST | ||
|
||
|
||
def is_older(left, right): | ||
if not os.path.isfile(right): | ||
return False | ||
assert os.path.isfile(left) | ||
return os.path.getmtime(left) < os.path.getmtime(right) | ||
|
||
|
||
def avoid_repeating( | ||
emu: str, input_file: str, output_dir: str, | ||
force_run: bool, ok, func): | ||
# this function avoid repeated run for most common situations | ||
input_file_n = os.path.basename(input_file) | ||
emu_n = os.path.basename(emu) | ||
|
||
# python 3.6 please | ||
running_lock_name = f'running-{func.__name__}-{emu_n}-{input_file_n}' | ||
running_lock_file = pjoin(output_dir, running_lock_name) | ||
|
||
if os.path.isfile(running_lock_file): | ||
print('running lock found in {}, skip!'.format(output_dir)) | ||
return | ||
else: | ||
sh.touch(running_lock_file) | ||
|
||
script_ts_dir = pjoin(str(Path(__file__).resolve().parent), 'ts') | ||
safe_mkdir(script_ts_dir) | ||
# python 3.6 please | ||
ts_name = f'ts-{func.__name__}-{emu_n}-{input_file_n}' | ||
|
||
out_ts_file = pjoin(output_dir, ts_name) | ||
if os.path.isfile(out_ts_file): | ||
out_ts = os.path.getmtime(out_ts_file) | ||
else: | ||
out_ts = 0.0 | ||
|
||
script_ts_file = pjoin(script_ts_dir, ts_name) | ||
if not os.path.isfile(script_ts_file): | ||
sh.touch(script_ts_file) | ||
script_ts = os.path.getmtime(script_ts_file) | ||
|
||
program_ts = os.path.getmtime(emu) | ||
input_binary_ts = os.path.getmtime(input_file) | ||
|
||
cmd_ts = max(script_ts, program_ts, input_binary_ts) | ||
|
||
if out_ts < cmd_ts or force_run: | ||
try: | ||
func() | ||
sh.touch(out_ts_file) | ||
except Exception as e: | ||
if (ok()): | ||
sh.touch(out_ts_file) | ||
else: | ||
print(e) | ||
sh.rm(running_lock_file) | ||
else: | ||
print('none of the inputs is older than output, skip!') | ||
if os.path.isfile(running_lock_file): | ||
sh.rm(running_lock_file) | ||
|
||
|
||
def get_am_apps(): | ||
assert 'AM_HOME' in os.environ.keys() | ||
app_dir = pjoin(os.environ['AM_HOME'], 'apps') | ||
apps = set(os.listdir(app_dir)) | ||
with open('./am_app_filter.txt') as f: | ||
filters = set([line.strip() for line in f.readlines()]) | ||
return list(apps & filters) | ||
|
||
|
||
def get_am_app_dir(app: str): | ||
assert 'AM_HOME' in os.environ.keys() | ||
app_base_dir = pjoin(os.environ['AM_HOME'], 'apps') | ||
app_dir = pjoin(app_base_dir, app) | ||
assert os.path.isdir(app_dir) | ||
return app_dir | ||
|
||
|
||
if __name__ == '__main__': | ||
hex_dump('/home/zyy/projects/nexus-am/apps/cache-flush/build/cache-flush' | ||
'-riscv64-rocket.bin', 'test.txt') |
Oops, something went wrong.