Skip to content

Commit

Permalink
[formal] use filelist as source
Browse files Browse the repository at this point in the history
  • Loading branch information
unlsycn committed Sep 28, 2024
1 parent f5aaa81 commit 06f5a75
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Run Formal Verification"
run: |
nix build '.#gcd.jg-fpv' --impure
nix build '.#gcd.jg-fpv' --impure && $(exit $(cat result/failed_num))
1 change: 1 addition & 0 deletions templates/chisel/nix/gcd/jg-fpv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ stdenvNoCC.mkDerivation {
mkdir -p $out
cp report.txt $out
cp failed_num $out
cp -r jgproject $out
runHook postInstall
Expand Down
29 changes: 17 additions & 12 deletions templates/chisel/nix/gcd/scripts/FPV.tcl
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Make sure you have run the nix build command to build the formal results
# Now the result/ directory should contain the GCD.sv and GCDFormal.sv

clear -all

# Analyze design under verification files
set RESULT_PATH .

# Analyze source files and property files
analyze -sv12 \
${RESULT_PATH}/GCD.sv \
${RESULT_PATH}/GCDFormal.sv
set fd [open ./filelist.f r]
if {$fd < 0} {
error "File open failed!"
}
set filelist [split [read $fd] "\n"]
close $fd

foreach file $filelist {
if {[string length $file]} {
analyze -sv12 \ $file
}
}

# Elaborate design and properties
elaborate -top GCDFormal
elaborate

# Set up Clocks and Resets
clock clock
Expand All @@ -32,8 +35,10 @@ set failed_properties [get_property_list -include {status {cex unreachable}}]
set length [llength $failed_properties]
if { $length > 0 } {
puts "There are $length failed properties!"
exit 1
} else {
puts "All properties passed!"
exit 0
}
set failed_num [open failed_num w]
puts $failed_num "$length"
close $failed_num
exit 0

0 comments on commit 06f5a75

Please sign in to comment.