Refactor project setup for our purposes

This commit is contained in:
Zachary Snow 2019-02-08 00:19:39 -05:00
parent bfafea5dd8
commit b46009af53
12 changed files with 104 additions and 72 deletions

View File

@ -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

View File

@ -1,4 +1,4 @@
module Language.Verilog.AST
module Language.SystemVerilog.AST
( Identifier
, Module (..)
, ModuleItem (..)

View File

@ -1,13 +1,13 @@
module Language.Verilog.Parser
module Language.SystemVerilog.Parser
( parseFile
, preprocess
) where
import Language.Verilog.AST
import Language.Verilog.Parser.Lex
import Language.Verilog.Parser.Parse
import Language.Verilog.Parser.Preprocess
import Language.Verilog.Parser.Tokens
import Language.SystemVerilog.AST
import Language.SystemVerilog.Parser.Lex
import Language.SystemVerilog.Parser.Parse
import Language.SystemVerilog.Parser.Preprocess
import Language.SystemVerilog.Parser.Tokens
-- | Parses a file given a table of predefined macros, the file name, and the file contents.
parseFile :: [(String, String)] -> FilePath -> String -> [Module]

View File

@ -1,10 +1,10 @@
{
{-# OPTIONS_GHC -w #-}
module Language.Verilog.Parser.Lex
module Language.SystemVerilog.Parser.Lex
( alexScanTokens
) where
import Language.Verilog.Parser.Tokens
import Language.SystemVerilog.Parser.Tokens
}

View File

@ -1,12 +1,12 @@
{
module Language.Verilog.Parser.Parse (modules) where
module Language.SystemVerilog.Parser.Parse (modules) where
import Data.Bits
import Data.List
import Data.BitVec
import Language.Verilog.AST
import Language.Verilog.Parser.Tokens
import Language.SystemVerilog.AST
import Language.SystemVerilog.Parser.Tokens
}
%name modules

View File

@ -1,4 +1,4 @@
module Language.Verilog.Parser.Preprocess
module Language.SystemVerilog.Parser.Preprocess
( uncomment
, preprocess
) where

View File

@ -1,4 +1,4 @@
module Language.Verilog.Parser.Tokens
module Language.SystemVerilog.Parser.Tokens
( Token (..)
, TokenName (..)
, Position (..)

View File

@ -1,4 +1,4 @@
module Language.Verilog.Simulator
module Language.SystemVerilog.Simulator
( Simulator
, SimCommand (..)
, SimResponse (..)
@ -16,7 +16,7 @@ import Data.VCD hiding (Var, step)
import qualified Data.VCD as VCD
import Data.BitVec
import Language.Verilog.Netlist
import Language.SystemVerilog.Netlist
--check msg = putStrLn msg >> hFlush stdout

View File

@ -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

61
sv2v.cabal Normal file
View File

@ -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

18
sv2v.hs Normal file
View File

@ -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

View File

@ -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