0

我正在使用 icarus verilog 的最新主分支构建。

我应该期望以下运行吗?

module string_display ();

//reg [10:0][7:0] x = "initial";
string x = "initial";

always @* begin
  $display ("x = %s",x);
end

initial begin

  // Assign new string 
  x = "aaaaa";
  #1

  // Assign new string     
  x = "bbbb";
  #1

  #1 $finish;
end

endmodule

以上给出

internal error: 18vvp_fun_anyedge_sa: recv_string(initial) not implemented
vvp: vvp_net.cc:2972: virtual void vvp_net_fun_t::recv_string(vvp_net_ptr_t, const string&, vvp_context_t): Assertion `0' failed.

但是,如果我通过取消注释上面的行将“x”定义为 reg,那么它会按预期工作......

x =       aaaaa
x =        bbbb
4

3 回答 3

2

不,您不应该期望 Icarus Verilog 支持string关键字,该关键字是在 IEEE Std 1800 for SystemVerilog 中引入的。

根据伊卡洛斯网站

编译器本身旨在解析和详细说明写入 IEEE 标准IEEE Std 1364-2005的设计描述。这是一个相当大且复杂的标准,因此需要一些时间来填补标准的所有黑暗小巷,但这就是目标。

没有提到 IEEE Std 1800。

extensions.txt您可以从 github 站点查看该文件,其中指出:

Icarus Verilog 支持对基线 IEEE1364 标准的某些扩展。其中一些是从语言的扩展变体中挑选出来的,例如 SystemVerilog,...

但是,没有提到string那里。

我用edaplayground-g2012上的选项尝试了你的代码,但我得到了同样的错误。你可以在你的版本上试试。

于 2020-05-29T00:58:20.057 回答
2

错误消息告诉您究竟出了什么问题:“未实现”。这意味着它可以识别您想要做什么,但尚未实施。

于 2020-05-29T00:17:02.540 回答
0

我只是尝试了类似的东西,它对我有用:


module testit;

integer  code; 
string str;
string word_0;
string word_1;
string word_2;
string word_3;
string word_4;

integer file;

initial begin
    //file = $fopenr(" ../../testcase/testcase_4x4.txt");
    
    str    = "this is a test... 1, 2, 3";
    
    code = $sscanf(str, "%s %s %s %s %s", 
                    word_0, word_1, word_2, word_3, word_4);
                    
    $display("Number of words: %0d", code);
    
    $display("words[0]:(%-0s)", word_0);
    $display("words[1]:(%-0s)", word_1);
    $display("words[2]:(%-0s)", word_2);
    $display("words[3]:(%-0s)", word_3);
    $display("words[4]:(%-0s)", word_4);    
end

endmodule

Icarus Verilog 运行命令:

    iverilog -g2012 .\testit.sv       
    vvp -i a.out

输出:

Number of words: 5
words[0]:(this)
words[1]:(is)
words[2]:(a)
words[3]:(test...)
words[4]:(1,)

伊卡洛斯 Verilog 版本:

PS>iverilog -v
Icarus Verilog 11.0版(开发版)(s20150603-612-ga9388a89)

于 2020-10-29T17:24:32.703 回答