使用VCS简易流程:

简易VCS使用

举例,mux的verilog实现:

1、mux.v文件

module mux(a, b, c, d, en, sel, z);
	input  [3:0] a, b, c, d;
	input        en;
	input  [1:0] sel;
	output [3:0] z;
	reg    [3:0] z;
	always @(en or sel or a or b or c or d)
		begin
		   if(en == 1) z = 4'b0000;
		   else
		   begin
			  case(sel)
				 2'b00 : z = a;
				 2'b01 : z = b;
				 2'b10 : z = c;
				 2'b11 : z = d;
			  endcase
		   end
		end
endmodule

2、test_mux.v文件

添加的几行dump相关代码,参考了:参考

//`timescale 1ns/100ps

module mux_test();
reg  [3:0] a, b, c, d;
reg        en;
reg  [1:0] sel;
wire [3:0] z;

mux u1(a, b, c, d, en, sel, z);

//输出的波形文件
initial
begin
    $dumpfile("mux_test.vcd");  #输出的波形文件的文件名
    $dumpvars(0,u1);
end

initial
begin 
       en = 1;
   #10 en = 0; sel = 0; a = 4; b = 0;  c = 1;  d = 13;
   #10 en = 0; sel = 1; a = 4; b = 0;  c = 1;  d = 13;
   #10 en = 0; sel = 2; a = 8; b = 13; c = 15; d = 0;
   #10 en = 0; sel = 3; a = 8; b = 13; c = 15; d = 0;
   #10 en = 1; sel = 0; a = 0; b = 4;  c = 4;  d = 11;
   #10 en = 1; sel = 1; a = 0; b = 4;  c = 4;  d = 11;
   #10 en = 1; sel = 2; a = 9; b = 12; c = 13; d = 2;
   #10 en = 1; sel = 3; a = 9; b = 12; c = 13; d = 2;
   #20 $finish;
end
endmodule

3、调用vcs:

vcs test_mux.v mux.v -R -timescale=1ns/10ps +v2k +define+RTL_SAIF

成功后,在当前文件夹下就可以看到mux_text.vcd文件。该文件是在test_mux.v文件里面设置的波形文件名。

想要查看vcs常用仿真选项的可以参考:VCS常用仿真选项

4、调用dve

dve

然后在File->Open Database,找到刚刚的mux_text.vcd文件

简易VCS使用

添加成功后,我们就可以打开波形文件查看。找到想打开的那个,右键,Add To Waves -> New Wave View:

简易VCS使用

然后就看到了。

 

5、使用vcs时,遇到的问题

第一:本机Ubuntu内对vcs路径和一些alias的设置,在前一篇博文:安装vcs+verdi

第二:error:illegal 'timescale for module,module"AN2D0" has 'timescale but previous module do not

         解决:把2、test_mux.v文件第一行的·timescale注释掉。在第3步的调用vcs中,加入参数:-timescale=1ns/10ps。

         参考:http://bbs.eetop.cn/thread-315665-1-1.html

第三:/usr/bin/ld: /home/simon/CAD/synopsys/L-2016.06/linux64/lib/vcs_save_restore_new.o: relocation R_X86_64_32S against undefined symbol `_sigintr' can not be used when making a PIE object; recompile with -fPIC

          /usr/bin/ld: final link failed: Nonrepresentable section on output

          collect2: error: ld returned 1 exit status

          Makefile:104: recipe for target 'product_timestamp' failed

          make: *** [product_timestamp] Error 1

          Make exited with status 2

          CPU time: .159 seconds to compile + .049 seconds to elab + .205 seconds to link

          解决:第一步:sudo apt install gcc-4.8 g++-4.8         第二步:在调用vcs时,加入参数:vcs -full64 -cpp g++-4.8 -cc gcc-4.8 -LDFLAGS -Wl,-no-as-needed。

          参考:http://bbs.eetop.cn/thread-839371-2-1.html

 

最后:

祝君成功!

相关文章:

  • 2021-11-29
  • 2021-12-15
  • 2021-04-22
  • 2022-12-23
  • 2021-10-28
  • 2021-07-30
  • 2021-06-26
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案