求助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
回复
有奖活动 | |
---|---|
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
【有奖活动】智能可穿戴设备AR/VR如何引领科技新潮流! | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
【有奖活动】震撼来袭!这场直播将直击工程师的心灵! |
打赏帖 | |
---|---|
如何实现基于NXPiMX.RT1021的BH1730采集被打赏50分 | |
【换取手持数字示波器】AHT10温度检测分享被打赏40分 | |
【换取手持数字示波器】ACM32F070开发板点亮LCD屏和触控按键,串口,ADC被打赏40分 | |
【换取手持数字示波器】ACM32F070LCD屏和触控按键功驱动蜂鸣器分享被打赏40分 | |
【换取手持数字示波器】国民技术PWM功能知识分享被打赏40分 | |
【换取手持数字示波器】放大器运放知识分享被打赏40分 | |
【分享评测,赢取加热台】+开关电源AC输入知识分享被打赏30分 | |
【换取手持数字示波器】N32G430点亮数码管与串口打印、ADC被打赏40分 | |
老胖子聊电路--分析一个反馈电路被打赏50分 | |
【换取手持数字示波器】+点亮WS2812RGB灯被打赏50分 |