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 その170

Posted at

概要 

windowsでiverilogやってみた。
練習問題やってみた。

練習問題

$sinを使え。

サンプルコード



module test();
	integer i;
	real v = 0,
		x = 0;
	initial 
	begin
		for (i = 0; i < 36; i = i + 1)
		begin
			x = x + 0.2;
			v = $sin(x);
			$display(" %f, %f", x, v);
		end
		#10
		$finish;
	end
endmodule


実行結果

>vvp a.out
 0.200000, 0.198669
 0.400000, 0.389418
 0.600000, 0.564642
 0.800000, 0.717356
 1.000000, 0.841471
 1.200000, 0.932039
 1.400000, 0.985450
 1.600000, 0.999574
 1.800000, 0.973848
 2.000000, 0.909297
 2.200000, 0.808496
 2.400000, 0.675463
 2.600000, 0.515501
 2.800000, 0.334988
 3.000000, 0.141120
 3.200000, -0.058374
 3.400000, -0.255541
 3.600000, -0.442520
 3.800000, -0.611858
 4.000000, -0.756802
 4.200000, -0.871576
 4.400000, -0.951602
 4.600000, -0.993691
 4.800000, -0.996165
 5.000000, -0.958924
 5.200000, -0.883455
 5.400000, -0.772764
 5.600000, -0.631267
 5.800000, -0.464602
 6.000000, -0.279415
 6.200000, -0.083089
 6.400000, 0.116549
 6.600000, 0.311541
 6.800000, 0.494113
 7.000000, 0.656987
 7.200000, 0.793668
sin2.v:18: $finish called at 10 (1s)

以上。

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?