-
Notifications
You must be signed in to change notification settings - Fork 13
Set up RISCOF #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Set up RISCOF #44
Changes from 30 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
c0ddb20
run riscof setup --dutname=utoss_riscv
TheDeepestSpace 49e4641
build toolchain
TheDeepestSpace 6c8aa30
basic riscof config + SV dut
TheDeepestSpace 11b233e
parameterize top over MEM_SIZE
TheDeepestSpace f162aaa
add elf->mem conversion
TheDeepestSpace d68ed30
fix mem dump
TheDeepestSpace a83dc3c
WIP: mem size
TheDeepestSpace 70a4c69
add path to dut's folder in riscof config
TheDeepestSpace 02e0a61
specify memory size for top module
TheDeepestSpace 071e80a
move memory offset to 0 for dut
TheDeepestSpace 924509d
explicitly name mem file
TheDeepestSpace 3e9790d
pass memory to dut
TheDeepestSpace fccd83a
fix dut build
TheDeepestSpace 93ead55
make dut build a prereq for riscof run
TheDeepestSpace eab83e0
fix dut
TheDeepestSpace 3e69e6f
add logging
TheDeepestSpace 0a555ff
fix mem injection
TheDeepestSpace 779eda6
set up waiting and signature extraciton
TheDeepestSpace 820268a
fix mem file
TheDeepestSpace 07e6d04
only run most basic tests
TheDeepestSpace ea8d2b4
add timeout for ci jobs
TheDeepestSpace 8908f92
Merge branch 'main' into boris/riscof
TheDeepestSpace c226829
set up ci for riscof
TheDeepestSpace 44bad0c
fix riscof needs
TheDeepestSpace af72a1c
install riscof as root in ci
TheDeepestSpace 520a8dc
make dut dump its vcd for riscof tests
TheDeepestSpace 3e9a27e
extend timeout
TheDeepestSpace b9162a7
make riscof config dynamic
TheDeepestSpace 677004b
Merge branch 'main' into boris/riscof
TheDeepestSpace f13213b
add report upload
TheDeepestSpace d50b07a
Merge branch 'main' into boris/riscof
TheDeepestSpace a46dc5c
bump dut timeout to 10k cc's
TheDeepestSpace 7fb8235
stop toolchain from emitting compressed instructions
TheDeepestSpace 45dcd8b
bump timeout
TheDeepestSpace ca20d1d
fix memory signature dump
TheDeepestSpace 4a936b7
fix tohost
TheDeepestSpace 5206fce
fix riscof reporting in ci
TheDeepestSpace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,65 @@ | ||
| FROM public.ecr.aws/lts/ubuntu:22.04_stable AS builder | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
| ARG KEYRING_PATH=/usr/share/keyrings | ||
| ARG APT_SOURCES_PATH=/etc/apt/sources.list.d | ||
|
|
||
| # update and upgrade | ||
| RUN apt update && apt upgrade -y | ||
|
|
||
| # install essentialls | ||
| RUN apt update && \ | ||
| apt install -y \ | ||
| man make build-essential git zsh vim curl wget procps gnupg gnupg2 ca-certificates zip \ | ||
| software-properties-common | ||
|
|
||
| # unminimize the system | ||
| RUN bash -c "yes | unminimize" | ||
|
|
||
| # create dev sudo user | ||
| RUN useradd --create-home dev && \ | ||
| usermod --append --groups sudo dev && \ | ||
| apt update && apt install -y sudo && \ | ||
| echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
|
||
| # build riscv toolchain | ||
| RUN sudo apt-get install -y \ | ||
| autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk \ | ||
| build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev && \ | ||
| cd /tmp && \ | ||
| git clone --recursive https://github.com/riscv/riscv-gnu-toolchain.git && \ | ||
| git clone --recursive https://github.com/riscv/riscv-opcodes.git && \ | ||
| cd riscv-gnu-toolchain && \ | ||
| ./configure --prefix=/opt/riscv --with-arch=rv32i --with-abi=ilp32 && \ | ||
| sudo make | ||
|
|
||
| # main image stage | ||
| FROM public.ecr.aws/lts/ubuntu:22.04_stable | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
| ARG KEYRING_PATH=/usr/share/keyrings | ||
| ARG APT_SOURCES_PATH=/etc/apt/sources.list.d | ||
|
|
||
| # update and upgrade | ||
| RUN apt update && apt upgrade -y | ||
|
|
||
| # install essentialls | ||
| RUN apt update && \ | ||
| apt install -y \ | ||
| man make build-essential git zsh vim curl wget procps gnupg gnupg2 ca-certificates zip \ | ||
| software-properties-common | ||
|
|
||
| # unminimize the system | ||
| RUN bash -c "yes | unminimize" | ||
|
|
||
| # create dev sudo user | ||
| RUN useradd --create-home dev && \ | ||
| usermod --append --groups sudo dev && \ | ||
| apt update && apt install -y sudo && \ | ||
| echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
|
||
| # get toolchain artifacts from builder stage | ||
| COPY --from=builder /opt/riscv /opt/riscv | ||
| ENV PATH="/opt/riscv/bin:${PATH}" | ||
|
|
||
| USER dev |
This file contains hidden or 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 hidden or 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,15 @@ | ||
| [RISCOF] | ||
| ReferencePlugin=sail_cSim | ||
| ReferencePluginPath=M4__WORKSPACE_PATH/riscof/sail_cSim | ||
| DUTPlugin=utoss_riscv | ||
| DUTPluginPath=M4__WORKSPACE_PATH/riscof/utoss_riscv | ||
|
|
||
| [utoss_riscv] | ||
| PATH=M4__WORKSPACE_PATH/riscof | ||
| pluginpath=M4__WORKSPACE_PATH/riscof/utoss_riscv | ||
| ispec=M4__WORKSPACE_PATH/riscof/utoss_riscv/utoss_riscv_isa.yaml | ||
| pspec=M4__WORKSPACE_PATH/riscof/utoss_riscv/utoss_riscv_platform.yaml | ||
| target_run=1 | ||
|
|
||
| [sail_cSim] | ||
| pluginpath=M4__WORKSPACE_PATH/riscof/sail_cSim |
This file contains hidden or 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,97 @@ | ||
| `timescale 1ns/1ps | ||
|
|
||
| `include "test/utils.svh" | ||
|
|
||
| module dut; | ||
|
|
||
| reg clk; | ||
| reg reset; | ||
|
|
||
| top #( .MEM_SIZE ( 250000 /* 1MB */ ) ) | ||
| top | ||
| ( .clk ( clk ) | ||
| , .reset ( reset ) | ||
| ); | ||
|
|
||
| initial begin | ||
| clk = 0; | ||
| forever #5 clk = ~clk; | ||
| end | ||
|
|
||
| initial begin | ||
| reset <= `TRUE; | ||
| @(posedge clk); #1; | ||
| reset <= `FALSE; | ||
|
|
||
| fork | ||
| watch_tohost(); | ||
| watch_timeout(); | ||
| join_any | ||
|
|
||
| $finish; | ||
| end | ||
|
|
||
| task watch_tohost(); | ||
| integer tohost; | ||
| reg [31:0] tohost_data; | ||
|
|
||
| $display("%m: waiting for tohost..."); | ||
| if ($value$plusargs("tohost=%h", tohost)) begin | ||
| $display("%m: watching tohost at address <%0d>", tohost); | ||
| forever begin | ||
| @(posedge clk); | ||
| tohost_data = top.memory.M[tohost]; | ||
| if (tohost_data != 0) begin | ||
| $display("%m: memory[tohost] written <%0d> at time %t", tohost_data, $time); | ||
| void'(extract_signature()); | ||
| end | ||
| end | ||
| end else begin | ||
| $display("%m: tohost not specified."); | ||
| end | ||
| endtask | ||
|
|
||
| task watch_timeout(); | ||
| $display("%m: waiting for timeout..."); | ||
| repeat (100) @(posedge clk); | ||
| $display("%m: timeout reached"); | ||
| void'(extract_signature()); | ||
| endtask | ||
|
|
||
| function bit extract_signature(); | ||
| integer begin_signature, end_signature; | ||
| string sig_filename; | ||
| integer sig_file, i, i_fixed; | ||
|
|
||
| if (!$value$plusargs("begin_signature=%h", begin_signature)) begin | ||
| $display("%m: begin_signature not specified."); | ||
| return 1; | ||
| end | ||
| if (!$value$plusargs("end_signature=%h", end_signature)) begin | ||
| $display("%m: end_signature not specified."); | ||
| return 1; | ||
| end | ||
| if (!$value$plusargs("signature=%s", sig_filename)) begin | ||
| $display("%m: signature file not specified."); | ||
| return 1; | ||
| end | ||
|
|
||
| $display("%m: extracting signature from <%0x> to <%0x> to %s", begin_signature, end_signature, sig_file); | ||
|
|
||
| sig_file = $fopen(sig_filename, "w"); | ||
| if (sig_file != 0) begin | ||
| for (i = begin_signature; i < end_signature; i = i + 1) begin | ||
| $fwrite(sig_file, "%08x\n", top.memory.M[i[31:2]]); | ||
| end | ||
| $fclose(sig_file); | ||
| $display("%m: signature written to %s", sig_filename); | ||
| return 0; | ||
| end else begin | ||
| $display("%m: failed to open signature file %s", sig_filename); | ||
| return 1; | ||
| end | ||
| endfunction | ||
|
|
||
| `SETUP_VCD_DUMP(dut) | ||
|
|
||
| endmodule |
This file contains hidden or 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 @@ | ||
| from pkgutil import extend_path | ||
| __path__ = extend_path(__path__, __name__) |
This file contains hidden or 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,18 @@ | ||
| OUTPUT_ARCH( "riscv" ) | ||
| ENTRY(rvtest_entry_point) | ||
|
|
||
| SECTIONS | ||
| { | ||
| . = 0x80000000; | ||
| .text.init : { *(.text.init) } | ||
| . = ALIGN(0x1000); | ||
| .tohost : { *(.tohost) } | ||
| . = ALIGN(0x1000); | ||
| .text : { *(.text) } | ||
| . = ALIGN(0x1000); | ||
| .data : { *(.data) } | ||
| .data.string : { *(.data.string)} | ||
| .bss : { *(.bss) } | ||
| _end = .; | ||
| } | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.