-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8c084c
commit 33edf96
Showing
3 changed files
with
49 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// ALUのテストベンチ | ||
module alutest; | ||
// テスト信号を定義 | ||
reg [31:0] a; | ||
reg [31:0] b; | ||
reg [1:0] sel; | ||
wire [31:0] out; | ||
|
||
alu u1(.*); | ||
|
||
// 信号の動きを宣言 | ||
// 初期値 | ||
initial begin | ||
sel = 0; | ||
a = 0; | ||
b = 0; | ||
#300 $stop; // 終了時間の定義。これがないと延々に回ってしまう! | ||
end | ||
|
||
// 周期変動 | ||
// ノンブロッキング代入することで遷移を同時にする。 | ||
always #1 | ||
a = a + 1; | ||
always #5 | ||
b = b + 1; | ||
always #30 | ||
sel = sel + 1; | ||
endmodule |