当前位置:网站首页>Method of using inout signal in Verilog
Method of using inout signal in Verilog
2022-06-22 15:13:00 【Zi Mu】
Catalog
One 、inout How to use it in design documents
1.1、inout The first way to use
1.2、inout The second use of the implementation
Two 、inout How to use it in simulation test
One 、inout How to use it in design documents
stay FPGA In the design process of , Sometimes we encounter two-way signals ( It can be used as output , Signals that can also be used as inputs are called bidirectional signals ). such as ,IIC In the bus SDA A signal is a two-way signal ,QSPI Flash During the four wire operation of the, the four signal lines are bidirectional signals . stay Verilog Keyword in inout Define bidirectional signals , Here is a summary of bidirectional signal processing methods .
1.1、inout The first way to use
actually , The essence of bidirectional signal is composed of a three state gate , Three state gate can output high level , Low level and high resistance states , stay FPGA in , The structure of a three state gate is shown in the figure below :

Describing this logic Verilog The code is as follows :
module inout_top
(
input I_data_in ,
inout IO_data ,
output O_data_out ,
input Control
);
assign IO_data = Control ? I_data_in : 1'bz ;
assign O_data_out = IO_data ;
endmoduleWhen Control by 1 when ,IO_data For export , Output I_data_in Value
When Control by 0 when ,IO_data For input , Assign the input signal to O_data_out
This code is in Vivado2015.4.2 Compilation environment RTL The picture is shown below

stay ISE14.7 Under the compilation environment of RTL The picture is shown below
It can be found in Vivado2015.4.2 Environmental Control The signal IBUF There's also a LUT, stay ISE14.7 In the environment Control A reverser is synthesized behind the signal , There's this LUT And the reason for the inverter is Control by 1 Only then IO_data Set to output , And in the Xilinx In a IOBUF Resource default T intention 0 when IO End is output ,T intention 1 when ,IO End as input , So the
assign IO_data = Control ? I_data_in : 1'bz ;//Control=1 when As the output Change it to
assign IO_data = (Control == 1’b0) ? I_data_in : 1'bz ;//Control=0 when As the output stay Vivado2015.4.2 Integrated under the environment RTL Figure below

stay ISE14.7 Under the environment of RTL The picture is shown below
obviously ,Vivado Environment LUT and ISE The inverter in the environment is missing , Saved 1 individual Cell resources .
1.2、inout The second use of the implementation
The above is the treatment inout The first way , The second treatment inout The way to signal is to call Xilinx Of IOBUF The original language ,IOBUF The primitive of can be found in Vivado2015.4.2 Of Language Templates Find .

Call the of this primitive Verilog The code is as follows :
module inout_top
(
input I_data_in,
inout IO_data ,
output O_data_out ,
input Control
);
IOBUF #(
.DRIVE(12), // Specify the output drive strength
.IBUF_LOW_PWR("TRUE"), // Low Power - "TRUE", High Performance = "FALSE"
.IOSTANDARD("DEFAULT"), // Specify the I/O standard
.SLEW("SLOW") // Specify the output slew rate
) IOBUF_inst (
.O(O_data_out), // Buffer output
.IO(IO_data), // Buffer inout port (connect directly to top-level port)
.I(I_data_in), // Buffer input
.T(Control) // 3-state enable input, high=input, low=output
);
endmodulestay Vivado2015.4.2 Integrated under the environment RTL The picture is shown below

stay ISE14.7 Integrated under the environment RTL The picture is shown below
Obviously and assign IO_data = (Control == 1’b0) ? I_data_in : 1'bz ; In this case, a comprehensive RTL Exactly the same as .
1.3、inout Use summary
utilize Verilog There are two ways to process bi-directional signals :
1、 Write code
assign IO_data = (Control == 1’b0)? I_data_in : 1'bz ;
assign O_data_out = IO_data ;2、 Exemplification IOBUF The original language
IOBUF #(
.DRIVE(12), // Specify the output drive strength
.IBUF_LOW_PWR("TRUE"), // Low Power - "TRUE", High Performance = "FALSE"
.IOSTANDARD("DEFAULT"), // Specify the I/O standard
.SLEW("SLOW") // Specify the output slew rate
) IOBUF_inst (
.O(O_data_out), // Buffer output
.IO(IO_data), // Buffer inout port (connect directly to top-level port)
.I(I_data_in), // Buffer input
.T(Control) // 3-state enable input, high=input, low=output
);Two 、inout How to use it in simulation test
Verilog Use in inout How to write and simulate - Baidu library
边栏推荐
- I took a private job and earned 15250. Is it still necessary to do my main business?
- flutter video_player實現監聽和自動播放下一首歌曲
- Front and back management system of dessert beverage store based on SSM framework dessert mall cake store [source code + database]
- KEIL仿真和vspd
- C language student management system (open source)
- Keil simulation and VSPD
- U++ operator learning notes
- Unity's rich text color sets the color to be fully transparent
- Deadlock found when trying to get lock; Try restarting transaction
- 剑指Offer46——把数字翻译成字符串
猜你喜欢

【浙江大学】考研初试复试资料分享

数据资产管理:数据发现,发现什么,怎么发现?

【Pr】基础流程

轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷

加密市场进入寒冬,是“天灾”还是“人祸”?

Fluentd is easy to get started. Combined with the rainbow plug-in market, log collection is faster
![[Software Engineering] acquire requirements](/img/52/01320eee5e519910a62f48d604b180.png)
[Software Engineering] acquire requirements

Are there many unemployed people in 2022? Is it particularly difficult to find a job this year?

Is the encryption market a "natural disaster" or a "man-made disaster" in the cold winter?

Database connection pool: implementation of connection pool function point
随机推荐
谷歌竞价账户可以探测到全球市场吗?
keil MDK 中使用虚拟串口调试串口
bochs 软件使用记录
[Software Engineering] design module
What does Alibaba cloud's cipu release mean for enterprise customers?
Thoroughly understand the builder mode (builder)
阿里云发布CIPU,对于企业客户意味着什么?
What is the value of a website? Why build an independent station
时隔17年,刘亦菲再次刷屏式爆红:普通人不想被淘汰,也要懂得这件事
PHP built-in protocols (supported and encapsulated protocols)
Le modèle de diffusion est encore fou! Cette fois - ci, la zone occupée était...
We will resolutely fight and win the hard battle of flood control and disaster relief and spare no effort to ensure the safety of people's lives and property
What are strong and weak symbols in embedded systems?
Struggle, programmer chapter 45 tenderness is like water and a good time is like a dream
Perceptron of machine learning
Sikulix select the picture of relative position (advanced version)
OpenVINO CPU加速调研
拜登簽署兩項旨在加强政府網絡安全的新法案
[live broadcast review] battle code pioneer phase VI: build a test subsystem and empower developers to provide
数据采集之:巧用布隆过滤器提取数据摘要