2020年4月10日 星期五

Verilog XOR Gate

Verilog  XOR Gate



1) 自動產生的verilog 檔案
module xor_gate_auto(
r,
s,
Y
);
input r;
input s;
output Y;

wire SYNTHESIZED_WIRE_0;
wire SYNTHESIZED_WIRE_1;
wire SYNTHESIZED_WIRE_2;
wire SYNTHESIZED_WIRE_3;

assign SYNTHESIZED_WIRE_1 =  ~r;
assign SYNTHESIZED_WIRE_0 =  ~s;
assign SYNTHESIZED_WIRE_3 = r & SYNTHESIZED_WIRE_0;
assign SYNTHESIZED_WIRE_2 = SYNTHESIZED_WIRE_1 & s;
assign Y = SYNTHESIZED_WIRE_2 | SYNTHESIZED_WIRE_3;

endmodule

2) Gate Level Verilog檔案
module xor_gate(r,s,Y);
input r,s;
output Y;
wire w1,w2,m,n;

not u1(w1,s);
not u2(w2,r);
and u3(m,w1,r);
and u4(n,w2,s);
or  u5(Y,m,n);

endmodule

3) 測試平台程式
// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps 
module TB;
//inputs
reg r=1'b0;
reg s=1'b0;
//outputs 
wire Y;

xor_gate UUT (r,s,Y);
initial 
 begin
  #100
   r=1'b0;s=1'b1;
  #100
   r=1'b1;s=1'b0;
  #100
   r=1'b1;s=1'b1;
  #100
   $stop;
 end
endmodule

4) 符號 與  線路圖


5) 其他設定'畫面

















沒有留言:

張貼留言

ESP32-Flutter-MQTT-IoT-Controller

 ESP32-Flutter-MQTT-IoT-Controller 這套系統包含了 Flutter 跨平台 App 、 ESP32 韌體 與 MQTT 雲端傳輸機制 。 專案中採用的 功能命名原則與對應關係 整理如下: 1. 核心功能名稱對照表 功能區塊 Python / ...