Skip to content

Commit

Permalink
Merge pull request #731 from infinitymdm/soc
Browse files Browse the repository at this point in the history
Bring soc branch up to date with main
  • Loading branch information
rosethompson authored Apr 15, 2024
2 parents 3c3d057 + 3d58865 commit 9515590
Show file tree
Hide file tree
Showing 246 changed files with 263,765 additions and 7,099 deletions.
18 changes: 14 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ linux/buildroot
linux/testvector-generation/boottrace.S
linux/testvector-generation/boottrace_disasm.log
sim/slack-notifier/slack-webhook-url.txt
sim/logs
fpga/generator/IP
fpga/generator/vivado.*
fpga/generator/.Xil/*
Expand All @@ -61,8 +60,13 @@ examples/asm/example/example
examples/C/sum/sum
examples/C/fir/fir
examples/fp/softfloat_demo/softfloat_demo
examples/fp/softfloat_demo/softfloat_demoDP
examples/fp/softfloat_demo/softfloat_demoQP
examples/fp/softfloat_demo/softfloat_demoSP
examples/fp/fpcalc/fpcalc
examples/fp/sqrttest/sqrttest
examples/C/inline/inline
examples/C/mcmodel/mcmodel
examples/C/sum_mixed/sum_mixed
examples/asm/trap/trap
examples/asm/etc/pause
Expand All @@ -89,7 +93,6 @@ synthDC/hdl
sim/power.saif
tests/fp/vectors/*.tv
synthDC/Summary.csv
sim/wkdir
tests/custom/work
tests/custom/*/*/*.list
tests/custom/*/*/*.elf
Expand All @@ -112,8 +115,6 @@ tests/wally-riscv-arch-test/riscv-test-suite/rv*i_m/I/src/*.S
tests/wally-riscv-arch-test/riscv-test-suite/rv*i_m/I/Makefrag
sim/branch_BP_GSHARE10.log
sim/branch_BP_GSHARE16.log
sim/cov/
sim/covhtmlreport/
sim/imperas.log
sim/results-error/
sim/test1.rep
Expand Down Expand Up @@ -186,3 +187,12 @@ sim/branch/*
sim/obj_dir
examples/verilog/fulladder/obj_dir
config/deriv
sim/questa/cov
sim/questa/covhtmlreport/
sim/questa/logs
sim/questa/wkdir
sim/verilator/logs
sim/verilator/wkdir
sim/vcs/logs
sim/vcs/wkdir
benchmarks/coremark/coremark_results.csv
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ all:
make install
make riscof
make testfloat
make verify
# make verify
make coverage
make benchmarks

Expand Down Expand Up @@ -39,8 +39,25 @@ imperasdv:
iter-elf.bash --search ${WALLY}/tests/riscof/work/wally-riscv-arch-test/rv64i_m
iter-elf.bash --search ${WALLY}/tests/riscof/work/riscv-arch-test/rv64i_m

imperasdv_cov:
touch ${WALLY}/sim/seed0.txt
echo "0" > ${WALLY}/sim/seed0.txt
# /opt/riscv/ImperasDV-OpenHW/scripts/cvw/run-elf-cov.bash --verbose --seed 0 --search ${WALLY}/tests/riscof/work/wally-riscv-arch-test/rv64i_m
# /opt/riscv/ImperasDV-OpenHW/scripts/cvw/run-elf-cov.bash --elf ${WALLY}/tests/riscof/work/riscv-arch-test/rv64i_m/I/src/add-01.S/dut/my.elf --seed ${WALLY}/sim/seed0.txt --coverdb ${WALLY}/sim/cov/rv64gc_arch64i.ucdb --verbose
/opt/riscv/ImperasDV-OpenHW/scripts/cvw/run-elf-cov.bash --elf ${WALLY}/tests/riscof/work/riscv-arch-test/rv64i_m/I/src/add-01.S/dut/my.elf --seed ${WALLY}/sim/seed0.txt --coverdb riscv.ucdb --verbose
vcover report -details -html sim/riscv.ucdb

funcovreg:
#iter-elf.bash --search ${WALLY}/tests/riscof/work/wally-riscv-arch-test/rv64i_m --cover
#iter-elf.bash --search ${WALLY}/tests/riscof/work/wally-riscv-arch-test/rv64i_m/I --cover
#iter-elf.bash --search ${WALLY}/tests/riscof/work/wally-riscv-arch-test/rv64i_m/privilege --cover
#iter-elf.bash --search ${WALLY}/tests/riscof/work/wally-riscv-arch-test/rv64i_m/Q --cover
rm -f ${WALLY}/tests/riscof/work/riscv-arch-test/rv64i_m/*/src/*/dut/my.elf
iter-elf.bash --search ${WALLY}/tests/riscof/work/riscv-arch-test/rv64i_m/I --cover
vcover report -details -html sim/riscv.ucdb

coverage:
cd ${WALLY}/sim; ./regresssion-wally -coverage -fp
cd ${WALLY}/sim; ./regression-wally -coverage -fp

benchmarks:
make coremark
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,12 @@ If you want to implement your own version of the chip, your tool and license com
Startups can expect to spend more than $1 million on CAD tools to get a chip to market. Commercial CAD tools are not realistically available to individuals without a university or company connection.


## Adding Cron Job for nightly builds

If you want to add a cronjob you can do the following:
1) `crontab -e`
2) add this code:
```
0 3 * * * BASH_ENV=~/.bashrc bash -l -c "PATH_TO_CVW/cvw/bin/wrapper_nightly_runs.sh > PATH_TO_LOG_FOLDER/cron.log"
```

2 changes: 1 addition & 1 deletion addins/riscv-arch-test
Submodule riscv-arch-test updated 305 files
3 changes: 2 additions & 1 deletion benchmarks/coremark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ PORT_CFLAGS = -g -mabi=$(ABI) -march=$(ARCH) -static -falign-functions=16 \
all: $(work_dir)/coremark.bare.riscv.elf.memfile

run:
(cd ../../sim && (time vsim -c -do "do wally-batch.do rv$(XLEN)gc coremark" 2>&1 | tee $(work_dir)/coremark.sim.log))
time wsim rv$(XLEN)gc coremark 2>&1 | tee $(work_dir)/coremark.sim.log
#(cd ../../sim && (time vsim -c -do "do wally-batch.do rv$(XLEN)gc coremark" 2>&1 | tee $(work_dir)/coremark.sim.log))

$(work_dir)/coremark.bare.riscv.elf.memfile: $(work_dir)/coremark.bare.riscv
riscv64-unknown-elf-objdump -D $< > $<.elf.objdump
Expand Down
107 changes: 107 additions & 0 deletions benchmarks/coremark/coremark_sweep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/python
##################################################
## coremark_sweep.py

## Written: Shreesh Kulkarni, [email protected]
## Created: 20 March 2024
## Modified: 08 April 2024
## Purpose: Wally Coremark sweep Script for both 32 and 64 bit configs with csv file extraction.

## Documentation:

# A component of the CORE-V-WALLY configurable RISC-V project.
# https://github.com/openhwgroup/cvw

# Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1

# Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
# except in compliance with the License, or, at your option, the Apache License version 2.0. You
# may obtain a copy of the License at

# https://solderpad.org/licenses/SHL-2.1/

# Unless required by applicable law or agreed to in writing, any work distributed under the
# License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions
# and limitations under the License.
###########################################################################################


import os
import re
import csv
# list of architectures to run.
arch_list = [
"rv32gc_zba_zbb_zbc",
"rv32im_zicsr_zba_zbb_zbc",
"rv32gc",
"rv32imc_zicsr",
"rv32im_zicsr",
"rv32i_zicsr",
"rv64gc_zba_zbb_zbc",
"rv64im_zicsr_zba_zbb_zbc",
"rv64gc",
"rv64imc_zicsr",
"rv64im_zicsr",
"rv64i_zicsr"
]
str="32"
# Define regular expressions to match the desired fields
mt_regex = r"Elapsed MTIME: (\d+).*?Elapsed MINSTRET: (\d+).*?COREMARK/MHz Score: [\d,]+ / [\d,]+ = (\d+\.\d+).*?CPI: \d+ / \d+ = (\d+\.\d+).*?Load Stalls (\d+).*?Store Stalls (\d+).*?D-Cache Accesses (\d+).*?D-Cache Misses (\d+).*?I-Cache Accesses (\d+).*?I-Cache Misses (\d+).*?Branches (\d+).*?Branches Miss Predictions (\d+).*?BTB Misses (\d+).*?Jump and JR (\d+).*?RAS Wrong (\d+).*?Returns (\d+).*?BP Class Wrong (\d+)"
#cpi_regex = r"CPI: \d+ / \d+ = (\d+\.\d+)"
#cmhz_regex = r"COREMARK/MHz Score: [\d,]+ / [\d,]+ = (\d+\.\d+)"
# Open a CSV file to write the results
with open('coremark_results.csv', mode='w', newline='') as csvfile:
fieldnames = ['Architecture', 'MTIME','MINSTRET','CM / MHz','CPI','Load Stalls','Store Stalls','D$ Accesses',
'D$ Misses','I$ Accesses','I$ Misses','Branches','Branch Mispredicts','BTB Misses',
'Jump/JR','RAS Wrong','Returns','BP Class Pred Wrong']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

writer.writeheader()

# Loop through each architecture and run the make commands
for arch in arch_list:
if(str in arch):
xlen_value='32'
else:
xlen_value='64'
os.system("make clean")
make_all = f"make all XLEN={xlen_value} ARCH={arch}"
os.system(make_all)

make_run = f"make run XLEN={xlen_value} ARCH={arch}"
print("Running: " + make_run)
output = os.popen(make_run).read() # Capture the output of the command

# Extract the Coremark values using regular expressions
mt_match = re.search(mt_regex, output,re.DOTALL)
#cpi_match = re.search(cpi_regex,output,re.DOTALL)
#cmhz_match = re.search(cmhz_regex,output,re.DOTALL)
#minstret_match = re.search(minstret_regex,output)

# Write the architecture and extracted values to the CSV file

mtime = mt_match.group(1)
minstret= mt_match.group(2)
cmhz= mt_match.group(3)
cpi= mt_match.group(4)
lstalls= mt_match.group(5)
swtalls= mt_match.group(6)
dacc= mt_match.group(7)
dmiss= mt_match.group(8)
iacc= mt_match.group(9)
imiss= mt_match.group(10)
br= mt_match.group(11)
brm= mt_match.group(12)
btb= mt_match.group(13)
jmp= mt_match.group(14)
ras= mt_match.group(15)
ret= mt_match.group(16)
bpc= mt_match.group(17)
#minstret = mt_instret_match.group(2)
writer.writerow({'Architecture': arch, 'MTIME': mtime,'MINSTRET':minstret,'CM / MHz':cmhz,'CPI':cpi,
'Load Stalls':lstalls,
'Store Stalls':swtalls,'D$ Accesses':dacc,'D$ Misses':dmiss,'I$ Accesses':iacc,'I$ Misses':imiss,
'Branches':br,'Branch Mispredicts':brm,'BTB Misses':btb,'Jump/JR':jmp,'RAS Wrong':ras,'Returns':ret,'BP Class Pred Wrong':bpc})
11 changes: 10 additions & 1 deletion bin/CModelBranchAccuracy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,23 @@
Directory="$1"
Files="$1/*.log"

for Pred in "bimodal" "gshare"
for Pred in "bimodal" "gshare" "local4" "local8" "local10"
do
for Size in $(seq 6 2 16)
do
if [ $Pred = "gshare" ]; then
SizeString="$Size $Size 18 1"
elif [ $Pred = "bimodal" ]; then
SizeString="$Size 18 1"
elif [ $Pred = "local4" ]; then
SizeString="$Size 4 18 1"
Pred="yehpatt"
elif [ $Pred = "local8" ]; then
SizeString="$Size 8 18 1"
Pred="yehpatt"
elif [ $Pred = "local10" ]; then
SizeString="$Size 10 18 1"
Pred="yehpatt"
fi

Product=1.0
Expand Down
25 changes: 25 additions & 0 deletions bin/docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# script to install docker
# based on https://docs.docker.com/engine/install/ubuntu/
# from Kunlin Han, entered by David Harris

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# verify
sudo docker run hello-world

# install podman
sudo apt-get -y install podman

2 changes: 1 addition & 1 deletion sim/lint-wally → bin/lint-wally
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if [ "$1" == "-nightly" ]; then
fi
done
else
configs=(rv32e rv64gc rv32gc rv32imc rv32i rv64i div_2_1i_rv64gc ) # add fdqh_rv64gc when working
configs=(rv32e rv64gc rv32gc rv32imc rv32i rv64i ) # add fdqh_rv64gc when working
fi

for config in ${configs[@]}; do
Expand Down
Loading

0 comments on commit 9515590

Please sign in to comment.