mirror of https://github.com/zachjs/sv2v.git
Refactor project setup for our purposes
This commit is contained in:
parent
bfafea5dd8
commit
b46009af53
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- | A parser for SystemVerilog.
|
||||||
|
module Language.SystemVerilog
|
||||||
|
( module Language.SystemVerilog.AST
|
||||||
|
, module Language.SystemVerilog.Parser
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Language.SystemVerilog.AST
|
||||||
|
import Language.SystemVerilog.Parser
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
module Language.Verilog.AST
|
module Language.SystemVerilog.AST
|
||||||
( Identifier
|
( Identifier
|
||||||
, Module (..)
|
, Module (..)
|
||||||
, ModuleItem (..)
|
, ModuleItem (..)
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
module Language.Verilog.Parser
|
module Language.SystemVerilog.Parser
|
||||||
( parseFile
|
( parseFile
|
||||||
, preprocess
|
, preprocess
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Language.Verilog.AST
|
import Language.SystemVerilog.AST
|
||||||
import Language.Verilog.Parser.Lex
|
import Language.SystemVerilog.Parser.Lex
|
||||||
import Language.Verilog.Parser.Parse
|
import Language.SystemVerilog.Parser.Parse
|
||||||
import Language.Verilog.Parser.Preprocess
|
import Language.SystemVerilog.Parser.Preprocess
|
||||||
import Language.Verilog.Parser.Tokens
|
import Language.SystemVerilog.Parser.Tokens
|
||||||
|
|
||||||
-- | Parses a file given a table of predefined macros, the file name, and the file contents.
|
-- | Parses a file given a table of predefined macros, the file name, and the file contents.
|
||||||
parseFile :: [(String, String)] -> FilePath -> String -> [Module]
|
parseFile :: [(String, String)] -> FilePath -> String -> [Module]
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
{-# OPTIONS_GHC -w #-}
|
{-# OPTIONS_GHC -w #-}
|
||||||
module Language.Verilog.Parser.Lex
|
module Language.SystemVerilog.Parser.Lex
|
||||||
( alexScanTokens
|
( alexScanTokens
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Language.Verilog.Parser.Tokens
|
import Language.SystemVerilog.Parser.Tokens
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
module Language.Verilog.Parser.Parse (modules) where
|
module Language.SystemVerilog.Parser.Parse (modules) where
|
||||||
|
|
||||||
import Data.Bits
|
import Data.Bits
|
||||||
import Data.List
|
import Data.List
|
||||||
|
|
||||||
import Data.BitVec
|
import Data.BitVec
|
||||||
import Language.Verilog.AST
|
import Language.SystemVerilog.AST
|
||||||
import Language.Verilog.Parser.Tokens
|
import Language.SystemVerilog.Parser.Tokens
|
||||||
}
|
}
|
||||||
|
|
||||||
%name modules
|
%name modules
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
module Language.Verilog.Parser.Preprocess
|
module Language.SystemVerilog.Parser.Preprocess
|
||||||
( uncomment
|
( uncomment
|
||||||
, preprocess
|
, preprocess
|
||||||
) where
|
) where
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
module Language.Verilog.Parser.Tokens
|
module Language.SystemVerilog.Parser.Tokens
|
||||||
( Token (..)
|
( Token (..)
|
||||||
, TokenName (..)
|
, TokenName (..)
|
||||||
, Position (..)
|
, Position (..)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
module Language.Verilog.Simulator
|
module Language.SystemVerilog.Simulator
|
||||||
( Simulator
|
( Simulator
|
||||||
, SimCommand (..)
|
, SimCommand (..)
|
||||||
, SimResponse (..)
|
, SimResponse (..)
|
||||||
|
|
@ -16,7 +16,7 @@ import Data.VCD hiding (Var, step)
|
||||||
import qualified Data.VCD as VCD
|
import qualified Data.VCD as VCD
|
||||||
|
|
||||||
import Data.BitVec
|
import Data.BitVec
|
||||||
import Language.Verilog.Netlist
|
import Language.SystemVerilog.Netlist
|
||||||
|
|
||||||
--check msg = putStrLn msg >> hFlush stdout
|
--check msg = putStrLn msg >> hFlush stdout
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
-- | A parser for Verilog.
|
|
||||||
module Language.Verilog
|
|
||||||
( module Language.Verilog.AST
|
|
||||||
, module Language.Verilog.Parser
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Language.Verilog.AST
|
|
||||||
import Language.Verilog.Parser
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
name: sv2v
|
||||||
|
version: 0.0.1
|
||||||
|
|
||||||
|
category: Language, Hardware, Embedded
|
||||||
|
|
||||||
|
synopsis: SystemVerilog to Verilog conversion
|
||||||
|
|
||||||
|
description:
|
||||||
|
A tool for coverting SystemVerilog to Verilog. Also exposes a limited
|
||||||
|
SystemVerilog parser and AST. Forked from the Verilog parser found at
|
||||||
|
https://github.com/tomahawkins/verilog
|
||||||
|
|
||||||
|
author: Zachary Snow <zach@zachjs.com>, Tom Hawkins <tomahawkins@gmail.com>
|
||||||
|
maintainer: Zachary Snow <zach@zachjs.com>
|
||||||
|
|
||||||
|
license: BSD3
|
||||||
|
license-file: LICENSE
|
||||||
|
|
||||||
|
homepage: https://github.com/zachjs/sv2v
|
||||||
|
|
||||||
|
build-type: Simple
|
||||||
|
cabal-version: >= 1.10
|
||||||
|
|
||||||
|
library
|
||||||
|
default-language: Haskell2010
|
||||||
|
build-tools:
|
||||||
|
alex >= 3 && < 4,
|
||||||
|
happy >= 1 && < 2
|
||||||
|
build-depends:
|
||||||
|
base >= 4.8.2.0 && < 5.0,
|
||||||
|
array >= 0.5.1.0 && < 0.6
|
||||||
|
|
||||||
|
exposed-modules:
|
||||||
|
Data.BitVec
|
||||||
|
Language.SystemVerilog
|
||||||
|
Language.SystemVerilog.AST
|
||||||
|
Language.SystemVerilog.Parser
|
||||||
|
Language.SystemVerilog.Parser.Lex
|
||||||
|
Language.SystemVerilog.Parser.Parse
|
||||||
|
Language.SystemVerilog.Parser.Preprocess
|
||||||
|
Language.SystemVerilog.Parser.Tokens
|
||||||
|
|
||||||
|
ghc-options: -W
|
||||||
|
|
||||||
|
executable sv2v
|
||||||
|
default-language: Haskell2010
|
||||||
|
main-is: sv2v.hs
|
||||||
|
Build-Depends:
|
||||||
|
base
|
||||||
|
ghc-options:
|
||||||
|
-O3
|
||||||
|
-threaded
|
||||||
|
-rtsopts
|
||||||
|
-with-rtsopts=-N
|
||||||
|
-funbox-strict-fields
|
||||||
|
-Wall
|
||||||
|
|
||||||
|
source-repository head
|
||||||
|
type: git
|
||||||
|
location: git://github.com/zachjs/sv2v.git
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{- sv2v
|
||||||
|
Author: Zachary Snow <zach@zachjs.com>
|
||||||
|
|
||||||
|
conversion entry point
|
||||||
|
-}
|
||||||
|
|
||||||
|
import System.IO
|
||||||
|
import System.Exit
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
let res = Left "unimplemented"
|
||||||
|
case res of
|
||||||
|
Left err -> do
|
||||||
|
hPrint stderr err
|
||||||
|
exitFailure
|
||||||
|
Right _ -> do
|
||||||
|
exitSuccess
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
name: verilog
|
|
||||||
version: 0.0.12
|
|
||||||
|
|
||||||
category: Language, Hardware, Embedded
|
|
||||||
|
|
||||||
synopsis: Verilog preprocessor, parser, and AST.
|
|
||||||
|
|
||||||
description:
|
|
||||||
A parser and supporting a small subset of Verilog.
|
|
||||||
Intended for machine generated, synthesizable code.
|
|
||||||
|
|
||||||
author: Tom Hawkins <tomahawkins@gmail.com>
|
|
||||||
maintainer: Tom Hawkins <tomahawkins@gmail.com>
|
|
||||||
|
|
||||||
license: BSD3
|
|
||||||
license-file: LICENSE
|
|
||||||
|
|
||||||
homepage: http://github.com/tomahawkins/verilog
|
|
||||||
|
|
||||||
build-type: Simple
|
|
||||||
cabal-version: >= 1.10
|
|
||||||
|
|
||||||
library
|
|
||||||
default-language: Haskell2010
|
|
||||||
build-tools:
|
|
||||||
alex >= 3 && < 4,
|
|
||||||
happy >= 1 && < 2
|
|
||||||
build-depends:
|
|
||||||
base >= 4.8.2.0 && < 5.0,
|
|
||||||
array >= 0.5.1.0 && < 0.6
|
|
||||||
|
|
||||||
exposed-modules:
|
|
||||||
Data.BitVec
|
|
||||||
Language.Verilog
|
|
||||||
Language.Verilog.AST
|
|
||||||
Language.Verilog.Parser
|
|
||||||
Language.Verilog.Parser.Lex
|
|
||||||
Language.Verilog.Parser.Parse
|
|
||||||
Language.Verilog.Parser.Preprocess
|
|
||||||
Language.Verilog.Parser.Tokens
|
|
||||||
|
|
||||||
ghc-options: -W
|
|
||||||
|
|
||||||
source-repository head
|
|
||||||
type: git
|
|
||||||
location: git://github.com/tomahawkins/verilog.git
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue