随笔分类 -  FPGA

关于FPGA的资料
摘要:module key (clk,rst,key_up,led);input clk,rst,key_up;output reg [3:0] led;parameter T10ms=31'd2_000_00;reg clk_state;reg [31:0] cnt;parameter state_in 阅读全文
posted @ 2016-03-08 21:11 luxiaolai 阅读(874) 评论(0) 推荐(0)
摘要:module tw(clk,k_or,k1,k2);input clk;output k_or,k1,k2;reg [2:0] c1,c2;reg m1,m2;initialbeginc1=0;c2=0;m1=0;m2=0;endalways @(posedge clk)beginif(c1==a)... 阅读全文
posted @ 2015-01-20 14:58 luxiaolai 阅读(256) 评论(0) 推荐(0)
摘要:(*synthesis,keep*)(*synthesis,probe_port,keep *)例:(*synthesis,probe_port,keep *) wire e;可用于wire型和reg型。 阅读全文
posted @ 2014-09-25 21:32 luxiaolai 阅读(375) 评论(0) 推荐(0)
摘要:/*****************************************************************************Copyright: 2013File name: led.vDescription: 使用HC595驱动数码管Author: Version: v1.0Date: 2013.05.09History: 无Connect:P3.4->pin114 P3.5->pin116 P3.6->pin118 *************************************************************** 阅读全文
posted @ 2014-03-30 10:51 luxiaolai 阅读(505) 评论(0) 推荐(0)
摘要:/*自己做的PWM程序*2014-01-09*/module pwm(clk,rst,led);input clk,rst;output [7:0] led;parameter T=31'd2000000;parameter C=31'd200_0;reg [31:0] cnt;reg [31:0] pul;reg on;always @ (posedge clk or negedge rst)if(!rst)begincnt<=0;pul<=0;endelse if(T==cnt)begincnt<=0;pul<=pul+100;if(pul==C)p 阅读全文
posted @ 2014-01-15 22:37 luxiaolai 阅读(372) 评论(0) 推荐(0)
摘要:module led(CLOCK,RESET,LED,KEY_UP);input CLOCK,RESET,KEY_UP;output reg [3:0] LED;parameter s1=2'b00,s2=2'b01,s3=2'b10,s4=2'b11;reg [1:0] current_state,next_state;parameter T1s=31'd2_000_0000;reg [31:0] cnt;reg t;always @(posedge CLOCK or negedge RESET)if(!RESET)begint<=0;cnt&l 阅读全文
posted @ 2013-11-14 21:59 luxiaolai 阅读(776) 评论(0) 推荐(0)
摘要:module lxl(clk,rst,led,sel,dig);input clk,rst;output reg [7:0] led;output reg [5:0] sel;output [7:0] dig;parameter s1=1'b0,s2=1'b1;reg current_state,next_state;parameter T1s=31'd2_0000_000;reg [4:0] t;reg [31:0] cnt,cnt1;wire w;reg clk_out;always @ (posedge clk or negedge rst)if(!rst)beg 阅读全文
posted @ 2013-06-23 10:17 luxiaolai 阅读(4424) 评论(0) 推荐(0)
摘要:module pwm(CLOCK,RESET,LED);input CLOCK,RESET;output reg [3:0] LED;parameter T1s=32'd1_00000;reg [31:0] t,count;reg [31:0] w;///*always @(posedge CLOCK or negedge RESET)if(!RESET)begincount<=0;t<=0;LED[0]<=0;endelse if(count==T1s)begincount<=0;t<=t+1000;if(t==T1s)t<=0;endelsebe 阅读全文
posted @ 2013-03-31 21:20 luxiaolai 阅读(773) 评论(0) 推荐(0)
摘要:对于频率测量,有很多的测试方法,这里我们介绍一种采用基准频率计数的方法测试频率。该测试方法非常容易理解。首先设计两个计数器BASE_CLK_CNT和CLK_TST_CNT,基准时钟BASE_CLK作为计数器BASE_CLK_CNT的输入时钟,被测信号CLK_TST作为CLK_TST_CNT的输入时钟。两个计数器同时开始计数,当CLK_TST_CNT计数到n时计数结束,这个时候根据BASE_CLK_CNT的值m和BASE_CLK的频率,可以计算出CLK_TST的频率。在上述的测频方法中,两个计数器同时开始计数是整个设计的难点。由于CLK_TST和BASE_CLK是两个异步信号,如果不对信号做特定 阅读全文
posted @ 2013-03-31 10:25 luxiaolai 阅读(2730) 评论(0) 推荐(0)
摘要:module test(KEY_UP,SEL,DIG,CLOCK,RESET);input KEY_UP,CLOCK,RESET;output [5:0] SEL;output reg [7:0] DIG;parameter cnt=23'd2_000_000;reg [22:0] cnt1;reg [31:0] count;reg t;wire b;always @ (posedge CLOCK or negedge RESET)beginif(!RESET)t<=1;else if(!KEY_UP)t<=0;else t<=1;endassign b=t;alwa 阅读全文
posted @ 2011-11-12 14:55 luxiaolai 阅读(274) 评论(0) 推荐(0)
摘要:学习Verilog必走的3个阶段 http://www.fpgaw.com/viewthread.php?tid=1209&fromuid=4862 阅读全文
posted @ 2011-11-10 18:31 luxiaolai 阅读(172) 评论(0) 推荐(0)