2020年5月6日 星期三

以Verilog 設計一個數位電路 (EX_201)--- always行為模式 --and 電路

以Verilog 設計一個數位電路 (EX_201)--- always行為模式 --and 電路


`timescale 1 ns/1 ns

module EX_201 (a, b, c, d, e);
input  a, b, c;
output d, e;
reg    d, e;

// non-behavioral writing style is also listed for comparison.
// d and e should be declared as wire in non-behavioral
// writing style.
//
// wire d, e;
//
// assign d = a & b;
// assign e = b & c;

always@(a or b or c)
begin
d = a & b;
e = b & c;
end

endmodule

`timescale 100 ns/1 ns

module testbench;
reg a, b, c;
wire d, e;
integer i;
EX_201 UUT(
.a(a),
.b(b),
.c(c),
.d(d),
.e(e) );
initial
begin
 for (i=0;i<=7;i=i+1) begin
{a,b,c}=i;
#20;
 end
 #20;
 $stop;
end
endmodule

沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...