2012年10月27日 星期六

P6-19 8bit 2x1MUX 適用於DE2-70

P6-19 8bit 2x1MUX 適用於DE2-70

























module _8bit_2x1Mux (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
  
  
//set original program input , output 

    //output [3:0] y;
    //input s;           //Select signal
    //input [3:0] a, b;  //Input data 
    
    wire [7:0] a,b;
    wire s;
    reg [7:0] y =8'bz ;


    //mapping to hardware 
    assign LEDR = SW;
    
    assign s=SW[17];
    assign a=SW[7:0];
    assign b=SW[15:8];       

always @ (s or a or b)
if (s)
y = b;
else
y = a;

    assign LEDG[7:0]=y;

endmodule

沒有留言:

張貼留言

Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3

  Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3 AngularJS 實例 <!DOCTYPE html> <html> <head> <meta charse...