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

Posted at

概要 

windowsでiverilogやってみた。
自作cpu、見つけたので、調査してみた。
uartやってみた。systemverilogだったのでverilogに書き換えた。

テストベンチ

module test();
	reg clk;
	reg rst;
	reg [7:0] tx_data;
	reg en;
	reg ien;
	wire busy_tx;
	wire tx;
	wire [7:0] rx_data;
	wire busy_rx;
	wire rx;
	wire ack;
	wire valid;
	wire irq;
	assign rx = tx;
	uart_tx #(.WAIT_COUNT(868)) uart_tx(.clk(clk), .rst(rst), .en(en), .tx_data(tx_data), .busy(busy_tx), .tx(tx));
	uart_rx #(.WAIT_COUNT(868)) uart_rx(.clk(clk), .rst(rst), .rx(rx), .ien(ien), .ack(ack), .rx_data(rx_data), .busy(busy_rx), .valid(valid), .irq(irq));
	initial
	begin
		tx_data = 8'b10010110;
	end
	initial
	begin
		clk = 0;
		forever #5 clk = ~clk;
	end
	initial
	begin
	#10;
		rst = 1;
	#10;
		rst = 0;
	end
	initial
	begin
		ien = 1;
	end
	initial
	begin
	#100;
	#10;
		en = 1;
	#10;
		en = 0;
	#90000;
		$finish;
	end
	initial
	begin
		$dumpfile("test.vcd");
		$dumpvars(0, test);
		$display(" tx       rx");
		$monitor(" %b %b", tx_data, rx_data);
	end
endmodule





実行結果

>vvp a.out
VCD info: dumpfile test.vcd opened for output.
 tx      rx
 10010110 xxxxxxxx
 10010110 10010110
uart.v:186: $finish called at 90120 (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?