Skip to content
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

Allow slashes in write_aig_external filenames #1443

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions intTests/test_external_abc/test.saw
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ let q_unsat = {{ \(x:[8]) -> x != 0 /\ x+x == x }};

write_verilog "write_verilog_unsat.v" q_unsat;
write_smtlib2_w4 "write_smtlib2_w4_unsat.smt2" q_unsat;
write_aig_external "write_aig_external_unsat.aig" q_unsat;
write_cnf_external "write_aig_external_unsat.cnf" q_unsat;
write_aig_external "./write_aig_external_unsat.aig" q_unsat;
write_cnf_external "./write_aig_external_unsat.cnf" q_unsat;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear: The ./ part is not suddenly required now, is it? You've just added it in this test case to exercise the new takeBaseName functionality, because the ./ prefix wouldn't have worked before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. It most certainly is not required, but this approach seemed like an easy way to make sure it was working.


// A formula that is satisfiable.
let q_sat = {{ \(x:[8]) -> x+x == x }};

write_verilog "write_verilog_sat.v" q_sat;
write_smtlib2_w4 "write_smtlib2_w4_sat.smt2" q_sat;
write_aig_external "write_aig_external_sat.aig" q_sat;
write_cnf_external "write_aig_external_sat.cnf" q_sat;
write_aig_external "./write_aig_external_sat.aig" q_sat;
write_cnf_external "./write_aig_external_sat.cnf" q_sat;

fails (prove_print sbv_abc q_sat);
fails (prove_print w4_abc_smtlib2 q_sat);
Expand Down
5 changes: 3 additions & 2 deletions src/SAWScript/Prover/Exporter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import qualified Data.Map as Map
import Data.Set (Set)
import qualified Data.SBV.Dynamic as SBV
import System.Directory (removeFile)
import System.FilePath (takeBaseName)
import System.IO
import System.IO.Temp(emptySystemTempFile)
import Data.Text (pack)
Expand Down Expand Up @@ -148,8 +149,8 @@ writeAIG f t = do
io $ AIG.writeAiger f aig

withABCVerilog :: FilePath -> Term -> (FilePath -> String) -> TopLevel ()
withABCVerilog baseName t buildCmd =
do verilogFile <- io $ emptySystemTempFile (baseName ++ ".v")
withABCVerilog fileName t buildCmd =
do verilogFile <- io $ emptySystemTempFile (takeBaseName fileName ++ ".v")
sc <- getSharedContext
write_verilog sc verilogFile t
io $
Expand Down