在Design Compiler中,Verilog文件可以用read_verilog命令读入,用link命令连接。以下是连接两个文件RegisterFile.v和Test.v的脚本:
# Read design files file mkdir ./work define_design_lib WORK -path ./work read_verilog {RegisterFile.v Test.v} current_design Test link
其中define_design_lib指定中间文件存放到work目录,否则默认会存放到当前目录,文件多了看起来比较混乱。另外,建议使用current_design命令显式指定当前模块。
如果没有使用参数(Parameter),这个脚本工作的很好,但是一旦在例化模块时指定了参数值,则会出错:
Information: Building the design 'RegisterFile' instantiated from design 'Test' with the parameters "2,1". (HDL-193) Warning: Cannot find the design 'RegisterFile' in the library 'WORK'. (LBR-1) Warning: Unable to resolve reference 'RegisterFile' in 'Test'. (LINK-5) 0
查看前面的信息也会发现,实际上模块是使用默认参数例化的,所以连接时找不到被例化模块的实现:
Inferred memory devices in process in routine RegisterFile line 21 in file './rtl/RegisterFile.v'. =======================================================&#