当前位置:网站首页>解决分频模块modelsim下仿真输出为stx的错误
解决分频模块modelsim下仿真输出为stx的错误
2022-07-29 05:25:00 【qq_46475176】
以下为uart的一个例程,以该程序为例,在modelsim下出现输出分频信号为stx型,也就是不确定信号,下面分析一下原因:
module uart_clkdiv(clk, rst_n, clkout);
input clk;
input rst_n;
output clkout;
reg clkout;
reg [15:0] cnt;
always @(posedge clk or negedge rst_n)
begin
if (!rst_n)
begin
cnt <= 16'b0;
clkout <= 1'b0;
end
else if(cnt == 16'd1)//pc communication set 13
begin
clkout <= 1'b1;
cnt <= cnt + 16'd1;
end
else if(cnt == 16'd3)//pc communication set 26
begin
clkout <= 1'b0;
cnt <= 16'd0;
end
else
begin
cnt <= cnt + 16'd1;
end
end
endmodule
绿色部分为改过后的代码。出错的原因就在于没有复位信号使各变量cnt clkout 产生一个初始值,才导致输出为不确定。在仿真的时候testbench中应先对复位信号拉低几个时钟周期使信号复位。因此在仿真的时候需要对各变量的初值明确指定,防止出现不确定信号。
边栏推荐
- Advanced socket programming (options and control information)
- 虹科白皮书 | 在工业4.0阶段,如何利用TSN时间敏感网络技术打造数字化工厂?
- Summary of winter vacation training (1.23~1.28) [first tier]
- 超低成本DDoS攻击来袭,看WAF如何绝地防护
- day15_泛型
- HOG+SVM实现行人检测
- 2022 summer second day information competition learning achievement sharing 2
- Official tutorial redshift 09 camera
- Leetcode 344. reverse string
- c语言问题
猜你喜欢
随机推荐
使用STP生成树协议解决网络中的二层环路问题
Maya aces workflow configuration (Arnold and redshift map configuration specification - restore the correct effect of the map under the SP aces process) PS restore the rendered map under the aces proc
虹科方案 | 在数字化的变电站中低成本实现无缝集成的独特解决方案
Leetcode 189. rotation array
不安全的第三方组件的漏洞如何做前置规避?
2022 summer second day information competition learning achievement sharing 2
Sliding window leetcode 76. minimum covering substring (hard) 76.76. minimumwindow substring (hard)
虹科分享 | 测试与验证复杂的FPGA设计(2)——如何在IP核中执行面向全局的仿真
如何判断业务被DDoS攻击?又会造成哪些危害?
Leetcode notes 605. can place flowers (easy) 605. planting flowers
虹科教您 | 想进入TSN领域?虹科教您如何搭建TSN测试系统
Why are the job requirements for software testing in 2022 getting higher and higher? Is there any secret in it?
UE4 高光官方参考值
虹科Automation softPLC | MoDK运行环境与搭建步骤(1)——运行环境简介
电脑系统没有standard tcp/ip port端口的处理操作
Idea practical shortcut key novice must see
Thinking about MySQL taking shell through OS shell
网站服务器80,443端口一直被恶意攻击怎么办?
day17_集合下
Vivado IP核之复数浮点数乘法 Floating-point









![Self study understanding of [chain forward star]](/img/b4/7f66026a482540bf27f088c321a840.png)