需 Import pin assignments DE2_115_pin_assignments
//=============================================
//gate level basic gate buf not bufif1 bufif0 notif1 notif0
//=============================================
module ch4_1_2_bufnot (SW, LEDR, LEDG , CLOCK_50 ,KEY
,HEX0 ,HEX1 ,HEX2,HEX3 ,HEX4 ,HEX5 ,HEX6 ,HEX7 );
input [17:0] SW; // toggle switches
input [3:0] KEY; // Push bottom
input CLOCK_50; //Clock 27MHz , 50Mhz
output [17:0] LEDR; // red LEDS
output [8:0] LEDG; // green LEDs
output [6:0] HEX0,HEX1,HEX2,HEX3,HEX4,HEX5,HEX6,HEX7 ; //7-segment display
assign HEX0=7'b111_1111; //off 7-segment Display
assign HEX1=7'b111_1111;
assign HEX2=7'b111_1111; //off 7-segment Display
assign HEX3=7'b111_1111;
assign HEX4=7'b111_1111;
assign HEX5=7'b111_1111;
assign HEX6=7'b111_1111;
assign HEX7=7'b111_1111;
assign A=SW[0]; //buffer
assign B=SW[1]; //not
assign C=SW[3]; //buf_if_1
assign D=SW[2];
assign E=SW[5]; //buf_if_0
assign F=SW[4];
assign G=SW[7]; //not_if_1
assign H=SW[6];
assign I=SW[9]; //not_if_0
assign J=SW[8];
buf (O_buf , A);
not (O_not , B);
bufif1 (O_bufif1, D, C); //buf_if_1 C=SW3=control pin
bufif0 (O_bufif0, F, E); //buf_if_1 E=SW5=control pin
notif1 (O_notif1, H, G); //buf_if_1 G=SW7=control pin
notif0 (O_notif0, J, I); //buf_if_1 J=SW9=control pin
assign LEDR[0] = O_buf;
assign LEDR[1] = O_not;
assign LEDR[2] = O_bufif1;
assign LEDR[4] = O_bufif0;
assign LEDR[6] = O_notif1;
assign LEDR[8] = O_notif0;
endmodule
沒有留言:
張貼留言