等同于Verilog文件中的系统Verilog打包的输入输出

时间:2019-11-23 18:35:33

标签: verilog system-verilog

我有一个如下所述的系统Verilog文件

module bist_wrapper 
(

input wire clk_mbist;
output wire BIST_GO_ts3,
  output  mbist_hsm_p::mbist_in_hsm_sysram_t  mbist_in,
  input   mbist_hsm_p::mbist_out_hsm_sysram_t mbist_out
);

 assign mbist_in.clk_mbist = clk_mbist;
 assign BIST_GO_ts3 = mbist_out.BIST_GO_ts3;
endmodule 

我需要创建与系统verilog文件等效的verilog文件,但是如何将系统verilog打包的输入输出作为verilog输入输出处理

下面的文件正确吗?我需要在这里声明“电线”吗?



module bist_wrapper (
clk_mbist, BIST_GO_ts3,mbist_in, mbist_out);

input clk_mbist;
output BIST_GO_ts3;

output  mbist_hsm_p::mbist_in_hsm_sysram_t  mbist_in;
  input   mbist_hsm_p::mbist_out_hsm_sysram_t mbist_out;

assign mbist_in.clk_mbist = clk_mbist;
 assign BIST_GO_ts3 = mbist_out.BIST_GO_ts3;
endmodule 

1 个答案:

答案 0 :(得分:0)

您不能在常规Verilog中使用软件包或导入符号。因此,您的示例不适用于verilog。

在verilog中共享类型和参数的通常方法是将它们包括在模块作用域内。例如,

文件类型。vh

typedef reg[3:0] out_t;

文件b.v

module b(in,out);
    `include "types.vh"
   output out_t out;
    ...
endmodle

因此,您需要将包的内容放在单独的文件中,并将其包含在var声明之前。