2012年11月6日 星期二

DE2 GPIO expansion Relay + LED實驗 + SW (3)


DE2 GPIO expansion Relay + LED實驗 + SW (3)
//   output [35:0]GPIO_0;
//   input  [35:0]GPIO_1;
//  assign GPIO_0 = GPIO_1[0] ? cnt : {32{cnt[26]}};






module EX_3 (GPIO_0 ,GPIO_1 , SW, LEDR, LEDG , CLOCK_27 ,KEY );

input  [17:0] SW; // toggle switches
input  [7:0] KEY;     // Push bottom
input  CLOCK_27; //Clock 27MHz , 50Mhz

output [17:0] LEDR; // red  LEDS   
  output [7:0] LEDG; // green LEDs
  
    output [35:0]GPIO_0;
input  [35:0]GPIO_1;
  
    reg [31:0] cnt;
    
    
    always @(posedge CLOCK_27)
          cnt <= cnt + 1;
   
   assign GPIO_0 = GPIO_1[0] ? cnt : {32{cnt[26]}};
   assign LEDR   = GPIO_0[31:14];
   assign LEDG[7:0] = GPIO_1[27:20];
       
endmodule

沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...