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 5 years have passed since last update.

windowsでiverilog その36

Posted at

概要

windowsでiverilogやってみた。
oneshot書いてみる。

写真

image

サンプルコード



module oneshot(input clk, input rst, input in, output reg out);
	reg prev = 0;
	always @(posedge clk)
	begin
		if (in ^ prev)
			out <= in;
		else
			out <= 0;
		prev <= in;
	end
endmodule

module test;
	reg clk,
		in;
	oneshot u(.clk(clk), .in(in), .out(out));
	initial
	begin
		clk = 0;
		in = 0;
		#2
			in = 1;
		#6
			in = 0;
		#2
			in = 1;
		#6
			in = 0;
		#20
			$finish;
	end
	always
	begin
		#1
			clk = ~clk;
	end
	initial
	begin
		$dumpfile("test.vcd");
		$dumpvars(0, u);
	end
endmodule




以上。

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?