(笔记)Quartus II 中用在Verilog文件调用VHDL模块传入参数问题

今天在编译一个Verilog文件,其中嵌入了VHDL的模块,其VHDL模块如下:

entity vhdl_module is
    generic (
        PARA1    : boolean := false;    -- boolean型
        PARA2    : boolean := false;    -- integral型
    );
    port (
        PORT_A: out std_logic;
        PORT_B: in std_logic;
    );
end vhdl_module;

architecture synth of vhdl_module is
    -- 此处省略
end synth;

在Verilog文件中做如下调用:

module top(
    clock,                        
    res_n,
    test
);
  
input           clock; 
input           res_n;  
output          test;


vhdl_module 
    #(
        .PARA1(1),
        .PRRA2(1)
    ) 
    vhdl_module_ins (    
    .PORT_A(res_n),
    .PORT_B(clock)
);

endmodule

Quartus II 编译后报错:

Error: VHDL type mismatch error at <component_name>.vhd: boolean type does not match integer literal

 

经查阅后得知,Quartus II在翻译VHDL中的boolean类型是用false和true传递的,而Synplify和ISE却用的是1和0传递的。故在此处会报错,需要改成如下方式:

module top(
    clock,                        
    res_n,
    test
);
  
input           clock; 
input           res_n;  
output          test;


vhdl_module 
    #(
        .PARA1("true"), // 此处修改,若false则填入“false”,需加引号,否则任然会报错!
        .PRRA2(1)
    ) 
    vhdl_module_ins (    
    .PORT_A(res_n),
    .PORT_B(clock)
);

endmodule

小小技巧,分享给大家。

 

ps:希望以后不同编译工具能够统一该调用参数的格式。

 

posted @ 2014-03-26 12:25  Kuvon  阅读(1728)  评论(0编辑  收藏  举报