|
- module hc03( //集电极(漏极)开路的四组二输入与非门 VCC:Pin14 GND:Pin7
- //1组
- input A1, //输入A Pin1
- input B1, //输入B Pin2
- output Y1, //输出 Pin3
- //2组
- input A2, //Pin4
- input B2, //Pin5
- output Y2, //Pin6
- //3组
- input A3, //Pin9
- input B3, //Pin10
- output Y3, //Pin8
- //4组
- input A4, //Pin12
- input B4, //Pin13
- output Y4 //Pin11
- );
- assign Y1 = (A1 & B1) ? 1'b0 : 1'bz;
- assign Y2 = (A2 & B2) ? 1'b0 : 1'bz;
- assign Y3 = (A3 & B3) ? 1'b0 : 1'bz;
- assign Y4 = (A4 & B4) ? 1'b0 : 1'bz;
- endmodule
- module main(
- input clk,
- output reg led //低电平(计算正确)点亮
- );
- wire Y1,Y2,Y3,Y4;
- hc03 U1(
- .A1(1'b1),
- .B1(1'b1),
- .Y1(Y1),
- .A2(1'b1),
- .B2(1'b1),
- .Y2(Y2),
- .A3(1'b1),
- .B3(1'b1),
- .Y3(Y3),
- .A4(1'b1),
- .B4(1'b1),
- .Y4(Y4)
- );
- always @(posedge clk) begin
- if({Y1,Y2,Y3,Y4} == 4'b0000) begin
- led <= 1'b0;
- end else begin
- led <= 1'b1;
- end
- end
- endmodule
复制代码
|
|