|
- module hc4072( //74HC4072 二组四输入端或门 VCC:Pin14 GND:Pin7
- input inA1, //Pin2
- input inA2, //Pin3
- input inA3, //Pin4
- input inA4, //Pin5
- input inB1, //Pin9
- input inB2, //Pin10
- input inB3, //Pin11
- input inB4, //Pin12
- output outA, //Pin1
- output outB //Pin13
- );
- assign {outA,outB} = {
- |{inA1,inA2,inA3,inA4},
- |{inB1,inB2,inB3,inB4},
- };
- endmodule
- module main(
- input clk,
- output reg led
- );
- wire [1:0] out;
- hc4072 hc4072(
- .inA1(1'b1),
- .inA2(1'b0),
- .inA3(1'b1),
- .inA4(1'b0),
- .inB1(1'b0),
- .inB2(1'b0),
- .inB3(1'b0),
- .inB4(1'b0),
- .outA(out[1]),
- .outB(out[0])
- );
- always @(posedge clk) begin
- if(out == 2'b10) begin
- led <= 1'b0;
- end else begin
- led <= 1'b1;
- end
- end
- endmodule
复制代码 |
|