diff options
author | Yann Herklotz <git@ymhg.org> | 2019-04-17 11:01:43 +0100 |
---|---|---|
committer | Yann Herklotz <git@ymhg.org> | 2019-04-17 11:01:43 +0100 |
commit | 1db2dbfd5ffa617e58e95d42fbc84c3cdae56b4a (patch) | |
tree | 87af85f8f0e2d1025c55cc30c9828812587d5068 /src/VeriFuzz/Sim/XST.hs | |
parent | 449caedc72a6ccc76934149205202d43052a214c (diff) | |
download | verismith-1db2dbfd5ffa617e58e95d42fbc84c3cdae56b4a.tar.gz verismith-1db2dbfd5ffa617e58e95d42fbc84c3cdae56b4a.zip |
Update simulator with Result type
Diffstat (limited to 'src/VeriFuzz/Sim/XST.hs')
-rw-r--r-- | src/VeriFuzz/Sim/XST.hs | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/VeriFuzz/Sim/XST.hs b/src/VeriFuzz/Sim/XST.hs index 40bd637..866563c 100644 --- a/src/VeriFuzz/Sim/XST.hs +++ b/src/VeriFuzz/Sim/XST.hs @@ -20,6 +20,7 @@ where import Prelude hiding (FilePath) import Shelly +import Shelly.Lifted (liftSh) import Text.Shakespeare.Text (st) import VeriFuzz.Sim.Internal import VeriFuzz.Sim.Template @@ -40,16 +41,18 @@ instance Synthesiser XST where defaultXST :: XST defaultXST = XST "xst" "netgen" -runSynthXST :: XST -> SourceInfo -> FilePath -> Sh () +runSynthXST :: XST -> SourceInfo -> FilePath -> ResultSh () runSynthXST sim (SourceInfo top src) outf = do - dir <- pwd - writefile xstFile $ xstSynthConfig top - writefile prjFile [st|verilog work "rtl.v"|] - writefile "rtl.v" $ genSource src - echoP "XST: run" - logger_ dir "xst" $ timeout (xstPath sim) ["-ifn", toTextIgnore xstFile] - echoP "XST: netgen" - logger_ dir "netgen" $ run + dir <- liftSh pwd + let exec = execute_ SynthFail dir "xst" + liftSh $ do + writefile xstFile $ xstSynthConfig top + writefile prjFile [st|verilog work "rtl.v"|] + writefile "rtl.v" $ genSource src + echoP "XST: run" + exec (xstPath sim) ["-ifn", toTextIgnore xstFile] + liftSh $ echoP "XST: netgen" + exec (netgenPath sim) [ "-w" , "-ofmt" @@ -57,14 +60,15 @@ runSynthXST sim (SourceInfo top src) outf = do , toTextIgnore $ modFile <.> "ngc" , toTextIgnore outf ] - echoP "XST: clean" - noPrint $ run_ - "sed" - [ "-i" - , "/^`ifndef/,/^`endif/ d; s/ *Timestamp: .*//;" - , toTextIgnore outf - ] - echoP "XST: done" + liftSh $ do + echoP "XST: clean" + noPrint $ run_ + "sed" + [ "-i" + , "/^`ifndef/,/^`endif/ d; s/ *Timestamp: .*//;" + , toTextIgnore outf + ] + echoP "XST: done" where modFile = fromText $ "xst_" <> top xstFile = modFile <.> "xst" |