|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
麻烦哪位懂systemverilog的大大看看这段代码,到底错在什么地方,如何改正!!
小弟刚开始自学systemverilog,这个是书上照着抄下来的源代码,结果老是报错,我用了modelsim还是抱同样的错误!!
########################################
### 源代码
`timescale 1ns/1ns
module dowhile();
int map[string];
map["hello"] = 1;
map["sad"] = 2;
map["world"] = 3;
string s;
initial begin : initial_a
s = "hello!";
if( map.first(s) )
do
$display( "%s : %d\n",s,map[s] );
while( map.next(s) );
end
endmodule
############################################
############################################
VCS 错误提示
###
vcs -sverilog dowhile.v
###
Parsing design file 'dowhile.v'
Error-[SE] Syntax error
Following verilog source has syntax error :
"dowhile.v", 4: token is '['
map["hello"] = 1;
^
1 error
CPU time: 2.668 seconds to compile
#################################################
modelsim 错误提示
###
-- Compiling module dowhile
** Error: D:/Workplace/Modelsim_projects/sim_dowhile_sv/dowhile.sv(4): near "[": syntax error, unexpected '[' |
|