Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
8bd58e96
Commit
8bd58e96
authored
Feb 08, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic build setup!
parent
b46009af
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
12 deletions
+37
-12
Data/BitVec.hs
+4
-5
Language/SystemVerilog/Parser/.gitignore
+2
-0
Makefile
+16
-0
sv2v.cabal
+4
-2
sv2v.hs
+11
-5
No files found.
Data/BitVec.hs
View file @
8bd58e96
...
@@ -8,7 +8,6 @@ module Data.BitVec
...
@@ -8,7 +8,6 @@ module Data.BitVec
)
where
)
where
import
Data.Bits
import
Data.Bits
import
Data.Semigroup
data
BitVec
=
BitVec
Int
Integer
deriving
(
Show
,
Eq
)
data
BitVec
=
BitVec
Int
Integer
deriving
(
Show
,
Eq
)
...
@@ -18,13 +17,13 @@ instance Num BitVec where
...
@@ -18,13 +17,13 @@ instance Num BitVec where
BitVec
w1
v1
*
BitVec
w2
v2
=
bitVec
(
max
w1
w2
)
(
v1
*
v2
)
BitVec
w1
v1
*
BitVec
w2
v2
=
bitVec
(
max
w1
w2
)
(
v1
*
v2
)
abs
=
id
abs
=
id
signum
(
BitVec
_
v
)
=
if
v
==
0
then
bitVec
1
0
else
bitVec
1
1
signum
(
BitVec
_
v
)
=
if
v
==
0
then
bitVec
1
0
else
bitVec
1
1
fromInteger
i
=
bitVec
(
wid
th
i
)
i
fromInteger
i
=
bitVec
(
wid
i
)
i
where
where
wid
th
::
Integer
->
Int
wid
::
Integer
->
Int
wid
th
a
wid
a
|
a
==
0
=
0
|
a
==
0
=
0
|
a
==
-
1
=
1
|
a
==
-
1
=
1
|
otherwise
=
1
+
wid
th
(
shiftR
a
1
)
|
otherwise
=
1
+
wid
(
shiftR
a
1
)
instance
Bits
BitVec
where
instance
Bits
BitVec
where
BitVec
w1
v1
.&.
BitVec
w2
v2
=
bitVec
(
max
w1
w2
)
(
v1
.&.
v2
)
BitVec
w1
v1
.&.
BitVec
w2
v2
=
bitVec
(
max
w1
w2
)
(
v1
.&.
v2
)
...
...
Language/SystemVerilog/Parser/.gitignore
0 → 100644
View file @
8bd58e96
Lex.hs
Parse.hs
Makefile
0 → 100644
View file @
8bd58e96
.PHONY
:
all sv2v clean
all
:
sv2v
Language/SystemVerilog/Parser/Lex.hs
:
Language/SystemVerilog/Parser/Lex.x
alex
-g
Language/SystemVerilog/Parser/Lex.x
-o
Language/SystemVerilog/Parser/Lex.hs
Language/SystemVerilog/Parser/Parse.hs
:
Language/SystemVerilog/Parser/Parse.y
happy
-agc
Language/SystemVerilog/Parser/Parse.y
-o
Language/SystemVerilog/Parser/Parse.hs
sv2v
:
Language/SystemVerilog/Parser/Lex.hs Language/SystemVerilog/Parser/Parse.hs
cabal install
clean
:
rm
-f
Language/SystemVerilog/Parser/Lex.hs
rm
-f
Language/SystemVerilog/Parser/Parse.hs
sv2v.cabal
View file @
8bd58e96
...
@@ -45,8 +45,11 @@ library
...
@@ -45,8 +45,11 @@ library
executable sv2v
executable sv2v
default-language: Haskell2010
default-language: Haskell2010
main-is: sv2v.hs
main-is: sv2v.hs
Build-Depends:
build-depends:
array,
base
base
other-modules:
Language.SystemVerilog.Parser
ghc-options:
ghc-options:
-O3
-O3
-threaded
-threaded
...
@@ -58,4 +61,3 @@ executable sv2v
...
@@ -58,4 +61,3 @@ executable sv2v
source-repository head
source-repository head
type: git
type: git
location: git://github.com/zachjs/sv2v.git
location: git://github.com/zachjs/sv2v.git
sv2v.hs
View file @
8bd58e96
{- sv2v
{- sv2v
Author: Zachary Snow <zach@zachjs.com>
-
Author: Zachary Snow <zach@zachjs.com>
-
conversion entry point
-
conversion entry point
-}
-}
import
System.IO
import
System.IO
import
System.Exit
import
System.Exit
import
System.Environment
import
Language.SystemVerilog.Parser
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
let
res
=
Left
"unimplemented"
[
filePath
]
<-
getArgs
content
<-
readFile
filePath
let
ast
=
parseFile
[]
filePath
content
let
res
=
Left
ast
case
res
of
case
res
of
Left
err
->
do
Left
err
->
do
hPrint
stderr
err
hPrint
stderr
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment