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?

windowsでiverilog その205

Posted at

概要 

windowsでiverilogやってみた。
cd4007見つけたので、テストベンチ書いてみた。

参考にしたページ

サンプルコード

module test;
	parameter CYCLE = 10;
	parameter DELAY1 = 10;
	reg [2:0] GIN;
	reg tgnd,
		tvcc;
	wire OUT;
	wire t1,
		t2;
	cd4007 u(.O12(OUT), .OP1(OUT), .OP13(OUT), .ON5(t2), .ON8(t1), .IP14(tvcc), .IP2(tvcc), .IP11(tvcc), .IN7(tgnd), .IN4(t1), .IN9(t2), .G6(GIN[0]), .G3(GIN[1]), .G10(GIN[2]));
	initial
	begin
		$dumpfile("test.vcd");
		$dumpvars(-1, u);
		$monitor("%d GIN=%b, OUT=%b", $stime, GIN, OUT);
	end
	initial
	begin
		tgnd = 1'b0;
		tvcc = 1'b1;
		#DELAY1
			GIN = 3'b000;
		#CYCLE
			GIN = 3'b001;
		#CYCLE
			GIN = 3'b010;
		#CYCLE
			GIN = 3'b011;
		#CYCLE
			GIN = 3'b100;
		#CYCLE
			GIN = 3'b101;
		#CYCLE
			GIN = 3'b110;
		#CYCLE
			GIN = 3'b111;
		#CYCLE
		$finish;
	end
endmodule

実行結果

>vvp a.out
VCD info: dumpfile test.vcd opened for output.
         0 GIN=xxx, OUT=x
        10 GIN=000, OUT=1
        20 GIN=001, OUT=1
        30 GIN=010, OUT=1
        40 GIN=011, OUT=1
        50 GIN=100, OUT=1
        60 GIN=101, OUT=1
        70 GIN=110, OUT=1
        80 GIN=111, OUT=0
c4007.v:67: $finish called at 900 (100ps)

以上。

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?