当前位置:网站首页>使用case语句时会产生锁存器的情况
使用case语句时会产生锁存器的情况
2022-07-17 17:15:00 【数据线】
摘要
- 在使用case语句且多输出时,每个case分支语句都要给出所有输出的赋值,否则电路会综合出锁存器。
- 在下面例子中,通过变量sel来选择四个输出up、down、left、right哪一个被赋值为1,给出了两种代码实现方式。
- 第一种实现方式中,每个case的分支语句给出了所有输出的值。
- 第二种实现方式中,虽然指定了变量的初始值,但每个case语句中并未对所有变量赋值。
代码
`timescale 1ns / 1ps
module top(
input [1:0] sel,
input [1:0] sel1,
output reg up,
output reg down,
output reg left,
output reg right,
output reg up1=0,
output reg down1=0,
output reg left1=0,
output reg right1=0
);
[email protected](*)begin
up=0;down=0;right=0;left=0;
case(sel)
2'b00:up=1'b1;
2'b01:down=1'b1;
2'b10:right=1'b1;
2'b11:left=1'b1;
default:up=1'b1;
endcase
end
[email protected](*)begin
case(sel1)
2'b00:up1=1'b1;
2'b01:down1=1'b1;
2'b10:right1=1'b1;
2'b11:left1=1'b1;
default:up1=1'b1;
endcase
end
endmodule
综合后的电路


由综合后的原理图可以看出,第二种代码实现方式产生了LDCE(异步清零的latch)
边栏推荐
- 超声波传感器(CH101&ch201) - Ⅰ
- 关于TCP/IP协议漏洞的安全措施
- Acwing786. The kth number
- Gold nanoparticles modified mil-101 framework material (AuNPs / mil-101) / loaded cof-tppa-1 (Au NPs / cof-tppa-1) | Qiyue reagent
- Att & CK actual combat series - red team actual combat (-)
- Uio-66 | fe3o4/cu3 (BTC) 2 metal organic framework (MOF) nanocomposites supported on silver nanoparticles | nagdf4:yb, er upconversion nanoparticles @zif-8
- Audio common terminal anatomy - never make a mistake again
- How can MySQL delete data tables and associated data tables
- Acwing785. 快速排序
- Will the market halve? What investment opportunities are there? 2020-03-11
猜你喜欢

2022全球开发者薪资曝光:中国排第19名,平均年薪23,790美元

Yunxi and Tencent cloud have reached a strategic cooperation to accelerate the expansion of the global live broadcast market

可视化ETL工具Kettle概念、安装及实战案例

Visual ETL tool kettle concept, installation and practical cases

Learning record: call TFTLCD

In depth sorting: summary of machine learning modeling and parameter adjustment methods
[email protected] )|Rhodamine 6G modified MOF material | catalase @zif composite | MOF"/>Lanthanide metal organic skeleton( [email protected] )|Rhodamine 6G modified MOF material | catalase @zif composite | MOF

备赛笔记:matplotlib学习笔记a

【Pygame 学习笔记】6.Cursor 鼠标光标

Stable super odds, 9 years old mixin | 2022 Jincang innovative product launch was successfully held
随机推荐
Do you still need to release the database connection manually with typeorm
Possible problems in inserting Excel data into MySQL database
ASP. Net collaborative OA office service management platform source code
深度梳理:机器学习建模调参方法总结
竞赛笔记:Numpy学习笔记
CMOS开关学习(一)
R语言--Cox模型校准曲线原理(一)数据来源
Enrollment publicity - Jiangnan University
Yu Meimei, Ji Gongdu
Brief analysis of circuit fault
The active and standby cache of redis cluster is full, causing frequent active and standby switchover
Opencv:06 morphology
可视化ETL工具Kettle概念、安装及实战案例
PostgreSQL function usage record
506. Relative ranking
回顾2008年金融危机,做长期主义投资者 2020-03-19
When will the deflationary market reverse? How should we operate? 2020-03-13
Competition notes: numpy learning notes
Harmonyos quick start: Hello World
Azkaban 安装文档