Skip to content

Commit 8855bb3

Browse files
committed
Passing in names of libraries.
1 parent 74a0c0e commit 8855bb3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

netlist-to-vhdl/Language/Netlist/GenVHDL.hs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,24 @@ import Language.Netlist.AST
1818
import Text.PrettyPrint
1919
import Data.Maybe(catMaybes)
2020
import Data.List(nub, (\\))
21-
genVHDL :: Module -> Doc
22-
genVHDL m = imports $$
2321

2422

2523
-- | Generate a 'Language.Netlist.AST.Module' as a VHDL file, in a 'Doc' structure . The ['String'] argument
2624
-- is the list of extra modules to import, typically [\"work.all\"].
25+
genVHDL :: Module -> [String] -> Doc
26+
genVHDL m others
27+
= imports others $$
2728
entity m $$
2829
architecture m
2930

30-
imports = vcat $ [
31-
text "library IEEE" <> semi,
32-
text "use IEEE.STD_LOGIC_1164.ALL" <> semi,
33-
text "use IEEE.NUMERIC_STD.ALL" <> semi,
34-
text "use work.all" <> semi
35-
]
31+
imports others = vcat
32+
[ text "library IEEE" <> semi
33+
, text "use IEEE.STD_LOGIC_1164.ALL" <> semi
34+
, text "use IEEE.NUMERIC_STD.ALL" <> semi
35+
] $$ vcat [
36+
text ("use " ++ other) <> semi
37+
| other <- others
38+
]
3639

3740

3841
entity :: Module -> Doc

0 commit comments

Comments
 (0)