馬場/春のプロジェクト2010/第1回
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[馬場/春プロ]]
**注意 [#x2f41dde]
tbのbeginに
$dumpfile("fa_tb_wf.vcd"); // file name
$dumpvars(0, fa_tb); // starting time, test module name
を加える必要がある。
これを加えることによってvcファイルをつくることができ、波形を確認することができる。
ncverilog fa_tb.v +ncaccess+rwc -s +gui &
の様にコンパイルする。
波形をみるときにスケールが多きすぎる時は、=でスケールを調整してくれる。
**目的 [#r97fb676]
NC-Verilog でfull adderを作成すること
**fa.v [#of9ced0b]
module fa(a,b,cin,s,cout);
input a,b,cin;
output s,cout;
wire a,b,cin,s,cout;
assign s = a^b^cin;
assign cout = (a&b)|(b&cin)|(cin&a);
endmodule
**fa_tb.v [#mbfd7ca5]
`timescale 1ns / 1ns
`include "fa.v"
module fa_tb;
reg a,b,cin;
wire s, cout;
fa fa0(.a(a),.b(b),.cin(cin),.s(s),.cout(cout));
initial begin
$dumpfile("fa_tb_wf.vcd"); // file name
$dumpvars(0, fa_tb); // starting time, test module name
a = 0; b = 0; cin = 0;
#100 a = 1; b = 0; cin = 0;
#100 a = 0; b = 1; cin = 0;
#100 a = 1; b = 1; cin = 0;
#100 a = 1; b = 0; cin = 1;
#100 a = 0; b = 1; cin = 1;
#100 a = 1; b = 1; cin = 1;
#100 a = 0; b = 0; cin = 0;
$finish;
end // initial begin
endmodule
**結果 [#qc3e3d34]
a b cin cout s
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
full adderの機能を満たしていることがわかる。
終了行:
[[馬場/春プロ]]
**注意 [#x2f41dde]
tbのbeginに
$dumpfile("fa_tb_wf.vcd"); // file name
$dumpvars(0, fa_tb); // starting time, test module name
を加える必要がある。
これを加えることによってvcファイルをつくることができ、波形を確認することができる。
ncverilog fa_tb.v +ncaccess+rwc -s +gui &
の様にコンパイルする。
波形をみるときにスケールが多きすぎる時は、=でスケールを調整してくれる。
**目的 [#r97fb676]
NC-Verilog でfull adderを作成すること
**fa.v [#of9ced0b]
module fa(a,b,cin,s,cout);
input a,b,cin;
output s,cout;
wire a,b,cin,s,cout;
assign s = a^b^cin;
assign cout = (a&b)|(b&cin)|(cin&a);
endmodule
**fa_tb.v [#mbfd7ca5]
`timescale 1ns / 1ns
`include "fa.v"
module fa_tb;
reg a,b,cin;
wire s, cout;
fa fa0(.a(a),.b(b),.cin(cin),.s(s),.cout(cout));
initial begin
$dumpfile("fa_tb_wf.vcd"); // file name
$dumpvars(0, fa_tb); // starting time, test module name
a = 0; b = 0; cin = 0;
#100 a = 1; b = 0; cin = 0;
#100 a = 0; b = 1; cin = 0;
#100 a = 1; b = 1; cin = 0;
#100 a = 1; b = 0; cin = 1;
#100 a = 0; b = 1; cin = 1;
#100 a = 1; b = 1; cin = 1;
#100 a = 0; b = 0; cin = 0;
$finish;
end // initial begin
endmodule
**結果 [#qc3e3d34]
a b cin cout s
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
full adderの機能を満たしていることがわかる。
ページ名: