sv-最小工程hello_world

一般语言都是通过最小工程来起步,最常见的就是hello_world 作为工程名,例如c 的
#include <stido.h>
void main()
{
	printf("hello_world!");
}

通过这个最小工程可以了解基本语法 和编译链接过程,建立一个大工程都是从最小工程开始扩展。
这种最小工程编译运行快,也是作为语法练习实验的常用手段,毕竟在大工程中遇到错误直接调试需要经历长时间的编译,再等到运行到出错点会非常费时消耗资源,在小工程里面实验通过再大工程改正验证结果就好了。

sv 代码: 一段验证randc 随机循环的代码 文件名: test.sv

class test;
	rand bit [31:0] addr,data;
	constraint c1
	{
		addr inside {[1:100]};
	    data inside {[1:100]};
	}
	endclass
module test_m;
	test t;
	initial begin
	t = new();
	t.randomize() with{addr == 100; data== 15;}
	$display(t.addr);
	$display(t.data);
	end
endmodule

编译命令:
xrun test.sv -notimingcheck -sv -access +rwc -64 -timescale 1ns/10ps -sem2009 -gui
也可以换成irun 的命令

这样一个最基本简单的system verilog 工程就搭建完成了。