suoto / hdl_checker

Repurposing existing HDL tools to help writing better code
GNU General Public License v3.0
192 stars 22 forks source link

Make compiler built in libraries dynamic #1

Closed suoto closed 8 years ago

suoto commented 8 years ago

Moving suoto/vim-hdl#4 to hdlcc.

Built-in libraries are statically defined, which means that things will break on different environments. We can either use the compiler to get them somehow or create an option for the user to set manually. Using the compiler is the preferred approach.

suoto commented 8 years ago

ModelSim shows configured libraries by calling vmap without parameters:

Reading /opt/modelsim/modelsim_dlx/linuxpe/../modelsim.ini
"std" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../std.
"ieee" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../ieee.
"vital2000" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../vital2000.
"verilog" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../verilog.
"std_developerskit" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../std_developerskit.
"synopsys" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../synopsys.
"modelsim_lib" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../modelsim_lib.
"sv_std" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../sv_std.
"floatfixlib" maps to directory /opt/modelsim/modelsim_dlx/linuxpe/../floatfixlib.
"simprim" maps to directory /opt/Xilinx/13.4/ISE_DS/ISE/vhdl/mti_se/10.1a/lin64/simprim/.
"unisim" maps to directory /opt/Xilinx/13.4/ISE_DS/ISE/vhdl/mti_se/10.1a/lin64/unisim.
"xilinxcorelib" maps to directory /opt/Xilinx/13.4/ISE_DS/ISE/vhdl/mti_se/10.1a/lin64/xilinxcorelib/.
"unimacro" maps to directory /opt/Xilinx/13.4/ISE_DS/ISE/vhdl/mti_se/10.1a/lin64/unimacro/.
"cpld" maps to directory /opt/Xilinx/13.4/ISE_DS/ISE/vhdl/mti_se/10.1a/lin64/cpld.

Similarly, GHDL displays via ghdl --dispconfig:

$ ghdl --dispconfig
command line prefix (--PREFIX): (not set)
environment prefix (GHDL_PREFIX): (not set)
exec prefix (from program name): /home/asouto/.local

library prefix: /home/asouto/.local/lib/ghdl
library directory: /home/asouto/.local/lib/ghdl
command_name: ghdl
default library pathes:
 /home/asouto/.local/lib/ghdl/v93/std/
 /home/asouto/.local/lib/ghdl/v93/ieee/

There outputs can be parsed and cached when creating the builder object.

suoto commented 8 years ago

Issue was fixed.