2012年10月8日 星期一

P4-7 2x4decoder 配合DE2-70 修改的程式

//Gate Level Description 
//y0 =an bn , y1=an b, y2=a bn ,y3=a b  
//assignments --> import pin assign --> de2-70-pin.csv

接腳:
http://www.4shared.com/file/E-118yKY/DE2_pin_assignments.html?



module dec2x4 (SW, LEDR, LEDG);
input [17:0] SW; // toggle switches
output [17:0] LEDR; // red LEDs
output [7:0] LEDG; // green LEDs


wire a,b;
wire [3:0] y;

    
assign LEDR = SW;
assign a = SW[0];
assign b = SW[1];

wire an, bn;

// Gate instantiations

// Create signals an and bn
not (an, a);
not (bn, b);

// And gates are instantiated
and (y[0], an, bn);
and (y[1], a, bn);
and (y[2], an, b);
and (y[3], a, b);


assign LEDG[3:0] = y;  // assignment to Green LEDs
endmodule





沒有留言:

張貼留言

WOKWI DHT22 & LED , Node-Red + SQLite database

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