乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Verilog 及Xilinx_FPGA入門(一)

       小小銳DarkRose 2014-07-23
      一、流水燈實(shí)驗(yàn);
      一、FPGA的工作是基于時(shí)鐘的,語言中幾乎每處都用到了always@(posedge clk),意思是clk
      上升沿觸發(fā)工作,之后執(zhí)行其下的語句。
      二、<=非阻塞語言,并行方式
      三、FPGA基本工作原理基于LUT查表,查表這也是一種特別重要的編程思想,下面的流水燈實(shí)現(xiàn)(二)差不多就是這種思想。

      (1)實(shí)現(xiàn)(一)
      module liushuideng(
      input clk,
      input rst,
      output reg[7:0]  led=8'b00000001;
      );


      reg[31:0] cnt=0;
       
      always@(posedge clk or negedge rst)
      if(!rst) begin   //rst按鍵 按下為低電平
              led<=8'b00000001;
              cnt<=0;        
      end else begin
                         
                          if(cnt==32'd100000000) //假如時(shí)鐘為100MHz 那么32‘d100000000代表1秒鐘
                         begin  
                         led<={led[6:0],led[7]}; //高電平代表點(diǎn)亮燈,實(shí)現(xiàn)循環(huán)左移位
                         cnt<=0;
                         end else begin 
                                       cnt<=cnt+1;
                                       end
       end
      (2)實(shí)現(xiàn)(二)
      module liushuideng(
      input clk,
      input rst,
      output reg[7:0]  led=8'b00000001;
      );


      reg[31:0] cnt=0;
       
      always@(posedge clk or negedge rst)
      if(!rst) begin   //rst按鍵 按下為低電平
              led<=8'b00000001;
              cnt<=0;        
      end else begin
                        if(cnt==32'd800000000)                    
                       begin
                       cnt<=0; //cnt==32'd800000000時(shí) 重新復(fù)位為0
                       end else begin
                                    cnt<=cnt+1;//每當(dāng)時(shí)鐘沿到來時(shí) cnt自加1

                                     end
                       case(cnt)     
                      32'd800000000:led<=8'b10000000;   //cnt為800000000時(shí)led==8‘d10000000(8代表位寬
      //缺省為最大位寬)
                      32'd700000000:led<=8'b01000000;
                
                      32'd600000000:led<=8'b00100000;
                        
                      32'd500000000:led<=8'b00010000;
                     32'd400000000:led<=8'b00001000;
                    32'd300000000:led<=8'b00000100;
                    32'd200000000:led<=8'b00000010;
                    32'd100000000:led<=8'b00000001;
                         
                    default:;
              
                   end
                 

                          end


       

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多