2012年10月12日 星期五

P5-29 1-4 demultiplexer with bitwise operators For DE2-70 Boards

//1-4 demultiplexer with bitwise operators





module Demux1x4 (SW, LEDR, LEDG);
input [17:0] SW; // toggle switches
output [17:0] LEDR; // red  LEDS   
  output [7:0] LEDG; // green LEDs
  
//set original program input , output 
wire [3:0] y;
wire I;
wire [1:0] S;     //Select signal

   
    //mapping to hardware 
    assign LEDR = SW;
    //assing input to SW
    assign I=SW[0];
    assign S=SW[2:1];
    

assign y[0] = (~S[1]) & (~S[0]) & I,
y[1] = (~S[1]) & (S[0]) & I,
y[2] = (S[1]) & (~S[0]) & I,
y[3] = (S[1]) & (S[0]) & I;

    //assign output to LEDG 
    
assign LEDG[3:0]=y;

endmodule

/*
//----------------------------------------
//Filename : demul1_4.v
//----------------------------------------
module demul1_4(y, I, S);
output [3:0] y;
input I;
input [1:0] S;     //Select signal

assign y[0] = (~S[1]) & (~S[0]) & I,
 y[1] = (~S[1]) & (S[0]) & I,
 y[2] = (S[1]) & (~S[0]) & I,
 y[3] = (S[1]) & (S[0]) & I;
endmodule

*/

沒有留言:

張貼留言

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

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