求助fpga编程问题

楼主试试下面的程序能不能实现你的功能。Pulse_In 是输入的脉冲,Pulse_Out是输出的100ns脉冲,rst全局复位,其余一些计数值根据你的需要修改。
基本思路是:对输入脉冲计数,分频为一个占空比为50%(或其他,只要高电平超过100ns即可)的脉冲,再用标准时钟对这个脉冲整形,是输入高电平保持100ns。
( 这个程序我临时写的,没做过仿真,如果有误,请告知 )
reg [10:0] InCnt;
parameter MAXCNT = 500;
reg InCnt_Out;
always@( posedge Pulse_In or nedgedge rst)
begin
if( ~rst )
begin
InCnt <= 0;
end
else
begin
if( InCnt < MAXCNT-250 )
begin
InCnt <= Cnt + 1;
end
else if( InCnt < MAXCNT )
begin
InCnt <= InCnt + 1;
InCnt_Out <= 0;
end
else
begin
InCnt <= 0;
InCnt_Out <= 1;
end
end
reg Pulse_Out;
reg [3:0] OutCnt;
always@( posedge CLK_100M or nededge rst )
begin
if( rst )
Pulse_Out <= 0;
OutCnt <= 0;
else
begin
if( (InCnt_Out==1) && (OutCnt==0) )
begin
OutCnt <= 1;
Pulse_Out <= 1;
end
else if( OutCnt < 11 )
begin
OutCnt <= OutCnt + 1;
Pulse_Out <= 1;
end if( ~InCnt_Out )
begin
OutCnt <= 0;
Pulse_Out <= 0;
end
else
begin
OutCnt <= 11;
Pulse_Out <= 0;
end
end
end

回复
打赏帖 | |
---|---|
我踩过的那些坑之混合OTL功放与落地音箱被打赏50分 | |
汽车电子中巡航控制系统的使用被打赏10分 | |
【我踩过的那些坑】工作那些年踩过的记忆深刻的坑被打赏100分 | |
分享汽车电子中巡航控制系统知识被打赏10分 | |
分享安全气囊系统的检修注意事项被打赏10分 | |
分享电子控制安全气囊计算机知识点被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】【OZONE】使用方法总结被打赏20分 | |
【分享开发笔记,赚取电动螺丝刀】【S32K314】芯片启动流程分析被打赏40分 | |
【分享开发笔记,赚取电动螺丝刀】【S32K146】S32DS RTD 驱动环境搭建被打赏12分 | |
【分享开发笔记,赚取电动螺丝刀】【IAR】libc标注库time相关库函数使用被打赏23分 |