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





沒有留言:

張貼留言

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站 (ESP32 + DHT22 + 1602 LCD)

零成本學 ESP32!在 Wokwi 打造你的第一個微型氣象站(溫度 濕度) (ESP32 + DHT22 + 1602 LCD) 想學物聯網(IoT)與 ESP32 電子實作,卻擔心接線與電壓規範搞砸嗎?透過強大的線上模擬器 Wokwi ,我們不需要花費任何硬體費用,打開瀏覽器...