|
- module hc21( //74HC21 二组四输入端与门 GND:Pin7 VCC:Pin14
- input inA1, //Pin1
- input inA2, //Pin2
- input inA3, //Pin4
- input inA4, //Pin5
- input inB1, //Pin9
- input inB2, //Pin10
- input inB3, //Pin12
- input inB4, //Pin13
- output outA, //Pin6
- output outB //Pin8
- );
- assign outA = &{inA1,inA2,inA3,inA4};
- assign outB = &{inB1,inB2,inB3,inB4};
- endmodule
- module main(
- input clk,
- output reg led
- );
- wire outA;
- wire outB;
- hc21 hc21(
- .inA1(1'b1),
- .inA2(1'b1),
- .inA3(1'b1),
- .inA4(1'b1),
- .inB1(1'b1),
- .inB2(1'b1),
- .inB3(1'b1),
- .inB4(1'b1),
- .outA(outA),
- .outB(outB)
- );
- always @(posedge clk) begin
- led <= !(outA && outB);
- end
- endmodule
复制代码
|
|