2020年5月14日 星期四

Verilog Types of Nets


A net data type must be used when a signal is:
  • driven by the output of some devices.
  • declared as an input or inout port.
  • on the left-hand side of a continuous assignment statement.

Types of Nets

Wire

The keyword wire is the most commonly used net in modeling circuits. When used in the code, it exhibits the same property as an electrical wire used for making connections.

module and_gate;

input wire A,B;
output wire C;

assign C = A & B;

endmodule

Tri

This is another type of net that has identical syntax and function as wire.

module 2:1_mux(out, a,b, control);

output out;
input a,b,control;
tri out;
wire a,b,control;

bufif0 b1(out, a, control); //b1 drives a when control = 0;z otherwise 
bufif1 b2(out, b, control); //b2 drives b when control = 1;z otherwise 

endmodule




bufif0(out, in, ctrl);
bufif1(out, in, ctrl);

supply0 and supply1

In every circuit we build, there are two crucial elements – power supply and ground. Hence, we use supply0 and supply1 nets to represent these two. The supply1 is used to model power supply. Whereas, the supply0 is for modeling ground.

supply1 Vcc; // all nets connected to Vcc are connected to power supply
supply0 GND; // all nets connected to GND are connected to ground









沒有留言:

張貼留言

Telegram +ESP32自動發報機

  Telegram   +ESP32自動發報機 這套系統是一個典型的 IoT(物聯網)架構 ,結合了遠端配置(Python)、通訊中介(MQTT)與硬體執行(ESP32)。 以下我為您拆解這兩支程式的核心運作原理: 一、 系統架構流程 Python 端 (控制台) :使用者輸入...