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

*/

沒有留言:

張貼留言

WOKWI DHT22 & LED , Node-Red + SQLite database

 WOKWI DHT22 & LED , Node-Red + SQLite database Node-Red程式 [{"id":"6f0240353e534bbd","type":"comment&...