编程语言
首页 > 编程语言> > 【编程技巧】— 优秀的编程思路

【编程技巧】— 优秀的编程思路

作者:互联网

1.计数器的优秀编程思路

always@(posedge clk or negedge rst_n)begin
if(rst_n == 1'b0)
    cnt <= MAX;
else(cnt == MAX && flage == 1'b1)
    cnt <= cnt + 1'b1;
else
    cnt <= cnt;
end

2.检测信号的下降沿

always@(posedge sclk)begin

rx_r1        <=        rs232_rx         ;
rx_r2        <=        rx_r1            ;
rx_r3        <=        rx_r2            ;

end

assign        rx_neg        =        ~ rx_r2 & rx_r3  ;

 

标签:begin,技巧,always,编程,posedge,rst,思路
来源: https://www.cnblogs.com/liuxiaoyanfpga/p/16131708.html