aboutsummaryrefslogtreecommitdiffstats
path: root/src/Verismith/Sim/XST.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2019-10-18 14:29:07 +0100
committerYann Herklotz <git@yannherklotz.com>2019-10-18 14:29:07 +0100
commite7f57642f068650ea362201b239efad1c9a841d9 (patch)
tree2d68c28c0644089b9afcfc21fc05f88d50ef6703 /src/Verismith/Sim/XST.hs
parent349c1fa290c068a0f4100469e7485d062dd995ce (diff)
downloadverismith-e7f57642f068650ea362201b239efad1c9a841d9.tar.gz
verismith-e7f57642f068650ea362201b239efad1c9a841d9.zip
Rename Sim to Tool
Diffstat (limited to 'src/Verismith/Sim/XST.hs')
-rw-r--r--src/Verismith/Sim/XST.hs85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/Verismith/Sim/XST.hs b/src/Verismith/Sim/XST.hs
deleted file mode 100644
index 9144ba7..0000000
--- a/src/Verismith/Sim/XST.hs
+++ /dev/null
@@ -1,85 +0,0 @@
-{-|
-Module : Verismith.Sim.XST
-Description : XST (ise) simulator implementation.
-Copyright : (c) 2018-2019, Yann Herklotz
-License : BSD-3
-Maintainer : yann [at] yannherklotz [dot] com
-Stability : experimental
-Portability : POSIX
-
-XST (ise) simulator implementation.
--}
-
-{-# LANGUAGE QuasiQuotes #-}
-
-module Verismith.Sim.XST
- ( XST(..)
- , defaultXST
- )
-where
-
-import Control.DeepSeq (NFData, rnf, rwhnf)
-import Data.Text (Text, unpack)
-import Prelude hiding (FilePath)
-import Shelly
-import Shelly.Lifted (liftSh)
-import Text.Shakespeare.Text (st)
-import Verismith.Sim.Internal
-import Verismith.Sim.Template
-import Verismith.Verilog.AST
-import Verismith.Verilog.CodeGen
-
-data XST = XST { xstBin :: !(Maybe FilePath)
- , xstDesc :: {-# UNPACK #-} !Text
- , xstOutput :: {-# UNPACK #-} !FilePath
- }
- deriving (Eq)
-
-instance Tool XST where
- toText (XST _ t _) = t
-
-instance Show XST where
- show t = unpack $ toText t
-
-instance Synthesiser XST where
- runSynth = runSynthXST
- synthOutput = xstOutput
- setSynthOutput (XST a b _) = XST a b
-
-instance NFData XST where
- rnf = rwhnf
-
-defaultXST :: XST
-defaultXST = XST Nothing "xst" "syn_xst.v"
-
-runSynthXST :: XST -> SourceInfo -> ResultSh ()
-runSynthXST sim (SourceInfo top src) = do
- dir <- liftSh pwd
- let exec n = execute_
- SynthFail
- dir
- "xst"
- (maybe (fromText n) (</> fromText n) $ xstBin sim)
- liftSh $ do
- writefile xstFile $ xstSynthConfig top
- writefile prjFile [st|verilog work "rtl.v"|]
- writefile "rtl.v" $ genSource src
- exec "xst" ["-ifn", toTextIgnore xstFile]
- exec
- "netgen"
- [ "-w"
- , "-ofmt"
- , "verilog"
- , toTextIgnore $ modFile <.> "ngc"
- , toTextIgnore $ synthOutput sim
- ]
- liftSh . noPrint $ run_
- "sed"
- [ "-i"
- , "/^`ifndef/,/^`endif/ d; s/ *Timestamp: .*//;"
- , toTextIgnore $ synthOutput sim
- ]
- where
- modFile = fromText top
- xstFile = modFile <.> "xst"
- prjFile = modFile <.> "prj"