小编n.r*_*n.r的帖子

Verilog 与 cocotb:分配语句

我的 Verilog 代码是一个仅使用assign sum = a+b. 问题是,虽然使用 运行它cocotb,但仍然sum未知ab有效值。

当我创建sum一个reg类型时,它就起作用了。

`timescale 1 ns / 1 ps

module adder(input [7:0] a,
        input [7:0] b,
        output reg  [7:0] sum,
        output [7:0] sum2);

    assign sum2=a+b;        // Trouble is here
    always@(a,b) begin
        sum=a+b;            // This works
    end

`ifdef COCOTB_SIM
    initial begin
        $dumpfile("adder.vcd");
        $dumpvars();
    end
`endif
endmodule
Run Code Online (Sandbox Code Playgroud)

gtk波形输出

python verilog fpga iverilog cocotb

3
推荐指数
1
解决办法
556
查看次数

标签 统计

cocotb ×1

fpga ×1

iverilog ×1

python ×1

verilog ×1