Skip to content

Commit

Permalink
[nix] add formal nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Sep 21, 2024
1 parent 6904c66 commit 754ae52
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 11 deletions.
6 changes: 6 additions & 0 deletions templates/chisel/nix/gcd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ in
formal-mlirbc =
scope.callPackage ./mlirbc.nix { elaborate = scope.formal-elaborate; };
formal-rtl = scope.callPackage ./rtl.nix { mlirbc = scope.formal-mlirbc; };
formal = scope.callPackage ./formal.nix {
rtl = scope.formal-rtl.override {
enable-layers =
[ "Verification" "Verification.Assert" "Verification.Cover" ];
};
};

# TODO: designConfig should be read from OM
tbConfig = with builtins;
Expand Down
4 changes: 4 additions & 0 deletions templates/chisel/nix/gcd/formal.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]>

{ lib, stdenv, rtl }
2 changes: 1 addition & 1 deletion templates/chisel/nix/pkgs/cds-fhs-env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lockedPkgs.buildFHSEnv {
profile = ''
[ ! -e "${jasperHome}" ] && echo "env JASPER_HOME not set" && exit 1
[ ! -d "${jasperHome}" ] && echo "JASPER_HOME not accessible" && exit 1
[ -z "${cdsLicenseFile}" ] && echo "env CDS LICENSE not set" && exit 1
[ -z "${cdsLicenseFile}" ] && echo "env CDS_LIC_FILE not set" && exit 1
export JASPER_HOME=${jasperHome}
export PATH=$JASPER_HOME/bin:$PATH
export _oldCdsEnvPath="$PATH"
Expand Down
30 changes: 30 additions & 0 deletions templates/chisel/report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

==============================================================
JasperGold Verification Results
==============================================================
2020.03 FCS 64 bits for Linux64 2.6.32-431.11.2.el6.x86_64
Host Name: Clo91eaf.
User Name: clo91eaf
Printed on: Saturday, Sep21, 2024 10:47:48 PM CST
Working Directory: /home/clo91eaf/Project/Plct/chisel-nix/templates/chisel


==============================================================
RESULTS
==============================================================

-------------------------------------------------------------------------------------------------------------------
Name | Result | Engine | Bound | Time
-------------------------------------------------------------------------------------------------------------------

---[ <embedded> ]--------------------------------------------------------------------------------------------------
[1] GCDFormal.GCD_ASSUMPTION_INPUT_NOT_VALID temporary ? 0.000 s
[2] GCDFormal.GCD_ASSUMPTION_INPUT_NOT_VALID:precondition1 covered Hp 1 0.008 s
[3] GCDFormal.GCD_ASSUMPTION_INPUT_4_6 temporary ? 0.000 s
[4] GCDFormal.GCD_ALWAYS_RESPONSE cex Hp 1 0.010 s
[5] GCDFormal.GCD_ALWAYS_RESPONSE:precondition1 covered Hp 1 0.010 s
[6] GCDFormal.GCD_NO_DOUBLE_FIRE proven N (12) 0.001 s
[7] GCDFormal.GCD_NO_DOUBLE_FIRE:precondition1 covered Hp 1 0.010 s
[8] GCDFormal.GCD_RESULT_IS_CORRECT proven N Infinite 0.027 s
[9] GCDFormal.GCD_RESULT_IS_CORRECT:precondition1 covered Hp 5 0.014 s
[10] GCDFormal.GCD_COVER_BACK_PRESSURE covered Hp 1 0.008 s
22 changes: 12 additions & 10 deletions templates/chisel/scripts/formal/FPV.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ prove -all
# Report proof results
report

# Set exit code for ci
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 exit code for ci, should only in batch mode

# report -file report.txt
# 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
# }

0 comments on commit 754ae52

Please sign in to comment.