0
2

ビジュアルプログラミングで高位合成 その6

Posted at

概要

ビジュアルプログラミングで組み合わせ回路を組み立てて、シュミレーションして、verilogを生成します。
高位合成です。
実は、今の実装では、半加算器、全加算器が高位合成できません。
半加算器の高位合成を実装しました。検証します。
検証編

テストベンチを書く。


module x(input A, input B, output Sum, output Carry);
	assign Sum = (A ^ B);
	assign Carry = (A & B);
endmodule

module test;
	reg A;
	reg B;
	x u(.A(A), .B(B), .Sum(Sum), .Carry(Carry));
	initial
	begin
		$display(" A   B   Sum Carry");
		$monitor(" %b  %b  %b  %b", A, B, Sum, Carry);
		A = 0;
		B = 0;
	#10;
		A = 0;
		B = 1;
	#10;
		A = 1;
		B = 0;
	#10;
		A = 1;
		B = 1;
	#10;
		$finish;
	end
endmodule

iverilogでシュミレーション実行

>iverilog ha0.v

>vvp a.out
 A   B   Sum Carry
 0  0  0  0
 0  1  1  0
 1  0  1  0
 1  1  0  1
ha0.v:27: $finish called at 40 (1s)

以上

0
2
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
2