-
Notifications
You must be signed in to change notification settings - Fork 14
Add Formal Verification Flow Using Yosys's riscv-formal #16
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
Open
5iri
wants to merge
11
commits into
SRA-VJTI:main
Choose a base branch
from
5iri:func_verif
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3d424fd
verification for rv32i is done
5iri d5e12ab
update README
5iri e3929a3
uart connection fix and relative path for all .sby files
5iri 33c6e65
compressed code size by making a dynamic script to generate verificat…
5iri 717f367
removed src files from formal/ directory
5iri 65af570
remove verify.sh, update README.md
5iri fa1edf6
sequential uart module
5iri c8634d6
fix comment issues
5iri 0bfeac2
update README to use boolector and sby
5iri d742ffb
Update .gitmodules
5iri 611a3ec
fix requested errors
5iri 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "riscv-formal"] | ||
| path = riscv-formal | ||
| url = [email protected]:5iri/riscv-formal.git | ||
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,45 @@ | ||
| add | ||
| addi | ||
| and | ||
| andi | ||
| auipc | ||
| beq | ||
| bge | ||
| bgeu | ||
| blt | ||
| bltu | ||
| bne | ||
| div | ||
| divu | ||
| jal | ||
| jalr | ||
| lb | ||
| lbu | ||
| lh | ||
| lhu | ||
| lui | ||
| lw | ||
| mul | ||
| mulh | ||
| mulhsu | ||
| mulhu | ||
| or | ||
| ori | ||
| rem | ||
| remu | ||
| sb | ||
| sh | ||
| sll | ||
| slli | ||
| slt | ||
| slti | ||
| sltiu | ||
| sltu | ||
| sra | ||
| srai | ||
| srl | ||
| srli | ||
| sub | ||
| sw | ||
| xor | ||
| xori |
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,132 @@ | ||
| [tasks] | ||
| --pycode-begin-- | ||
| with open("instruction_list.txt") as f: | ||
| for line in f: | ||
| name = line.strip() | ||
| if not name or name.startswith("#"): | ||
| continue | ||
| output(name) | ||
| --pycode-end-- | ||
|
|
||
| [options] | ||
| mode prove | ||
| expect pass | ||
| depth 20 | ||
| wait on | ||
|
|
||
| [engines] | ||
| smtbmc boolector | ||
|
|
||
| [script] | ||
| verilog_defines -D FORMAL | ||
| verilog_defines -D RISCV_FORMAL_NRET=1 | ||
| verilog_defines -D RISCV_FORMAL_ILEN=32 | ||
| verilog_defines -D RISCV_FORMAL_XLEN=32 | ||
| verilog_defines -D RISCV_FORMAL_CHANNEL_IDX=0 | ||
|
|
||
| --pycode-begin-- | ||
| with open("instruction_list.txt") as f: | ||
| for line in f: | ||
| insn = line.strip() | ||
| if not insn or insn.startswith("#"): | ||
| continue | ||
| output(f"{insn}: verilog_defines -D RISCV_FORMAL_INSN_MODEL=rvfi_insn_{insn}") | ||
| --pycode-end-- | ||
|
|
||
| --pycode-begin-- | ||
| design_sources = [ | ||
| "top.v", | ||
| "riscv_cpu.v", | ||
| "data_mem.v", | ||
| "execution_unit.v", | ||
| "instr_mem.v", | ||
| "memory_unit.v", | ||
| "seven_seg.v", | ||
| "writeback.v", | ||
| "alu.v", | ||
| "csr_exec.v", | ||
| "csr_file.v", | ||
| "decoder.v", | ||
| "interrupt_controller.v", | ||
| "pc.v", | ||
| "registerfile.v", | ||
| "timer.v", | ||
| "uart.v", | ||
| "EX_MEM.v", | ||
| "forwarding_unit.v", | ||
| "ID_EX.v", | ||
| "IF_ID.v", | ||
| "load_use_detector.v", | ||
| "MEM_WB.v", | ||
| "store_load_detector.v", | ||
| "store_load_forward.v" | ||
| ] | ||
|
|
||
| for src in design_sources: | ||
| output(f"read_verilog -formal {src}") | ||
| --pycode-end-- | ||
|
|
||
| read_verilog -sv -formal instr_defines.vh | ||
| read_verilog -sv -formal memory_map.vh | ||
| read_verilog -sv -formal rvfi_macros.vh | ||
|
|
||
| --pycode-begin-- | ||
| with open("instruction_list.txt") as f: | ||
| for line in f: | ||
| insn = line.strip() | ||
| if not insn or insn.startswith("#"): | ||
| continue | ||
| output(f"read_verilog -sv -formal insn_{insn}.v") | ||
| --pycode-end-- | ||
|
|
||
| read_verilog -sv -formal rvfi_insn_check.sv | ||
|
|
||
| hierarchy -top top | ||
| proc | ||
| opt | ||
| memory -nomap | ||
| flatten | ||
| setundef -undriven -anyseq | ||
| check | ||
| stat | ||
|
|
||
| [files] | ||
| instruction_list.txt | ||
| ../../rtl/top.v | ||
| ../../rtl/riscv_cpu.v | ||
| ../../rtl/data_mem.v | ||
| ../../rtl/execution_unit.v | ||
| ../../rtl/instr_mem.v | ||
| ../../rtl/memory_unit.v | ||
| ../../rtl/seven_seg.v | ||
| ../../rtl/writeback.v | ||
| ../../rtl/core_modules/alu.v | ||
| ../../rtl/core_modules/csr_exec.v | ||
| ../../rtl/core_modules/csr_file.v | ||
| ../../rtl/core_modules/decoder.v | ||
| ../../rtl/core_modules/interrupt_controller.v | ||
| ../../rtl/core_modules/pc.v | ||
| ../../rtl/core_modules/registerfile.v | ||
| ../../rtl/core_modules/timer.v | ||
| ../../rtl/core_modules/uart.v | ||
| ../../rtl/pipeline_stages/EX_MEM.v | ||
| ../../rtl/pipeline_stages/forwarding_unit.v | ||
| ../../rtl/pipeline_stages/ID_EX.v | ||
| ../../rtl/pipeline_stages/IF_ID.v | ||
| ../../rtl/pipeline_stages/load_use_detector.v | ||
| ../../rtl/pipeline_stages/MEM_WB.v | ||
| ../../rtl/pipeline_stages/store_load_detector.v | ||
| ../../rtl/pipeline_stages/store_load_forward.v | ||
| ../../rtl/include/instr_defines.vh | ||
| ../../rtl/include/memory_map.vh | ||
| ../../riscv-formal/checks/rvfi_macros.vh | ||
| ../../riscv-formal/checks/rvfi_insn_check.sv | ||
|
|
||
| --pycode-begin-- | ||
| with open("instruction_list.txt") as f: | ||
| for line in f: | ||
| insn = line.strip() | ||
| if not insn or insn.startswith("#"): | ||
| continue | ||
| output(f"../../riscv-formal/insns/insn_{insn}.v") | ||
| --pycode-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.