0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

高位合成言語NSL その3

Last updated at Posted at 2020-07-05

概要

windowsでiverilogやってみた。
nslやってみた。
半加算器、書いてみた。

サンプルコード

declare ha {
	input a;
	input b;
	output c;
	output o;
}
module ha {
	{
		c = a & b;
		o = a ^ b;
	}
}

テストベンチ

module test;
	reg clk,
		rst;
	reg a,
		b;
	ha u(.clk(clk), .rst(rst), .a(a), .b(b), .c(c), .o(o));
	always #1 clk = ~clk;
	integer i,
		j;
	initial
	begin
		clk = 0;
		rst = 1;
		#1
			rst = 0;
		#1
			rst = 1;
		$display("a b c o");
		$monitor("%b %b %b %b", a, b, c, o);
		for(i = 0; i < 2; i = i + 1) begin
			for(j = 0; j < 2; j = j + 1) begin
				a = i;
				b = j;
				#1;
			end
		end
		$finish;
	end
endmodule

実行結果


a b c o
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0


以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?