|
- module hc27( //74HC27 三组三输入端或非门 VCC:Pin14 GND:Pin7
- input inA1, //Pin1
- input inA2, //Pin2
- input inA3, //Pin13
- input inB1, //Pin3
- input inB2, //Pin4
- input inB3, //Pin5
- input inC1, //Pin9
- input inC2, //Pin10
- input inC3, //Pin11
- output outA, //Pin12
- output outB, //Pin6
- output outC //Pin8
- );
- assign {outA,outB,outC} = {
- !(|{inA1,inA2,inA3}),
- !(|{inB1,inB2,inB3}),
- !(|{inC1,inC2,inC3}),
- };
- endmodule
- module main(
- input clk,
- output reg led
- );
- wire [2:0] out;
- hc27 hc27 (
- .inA1(1'b0),
- .inA2(1'b0),
- .inA3(1'b0),
- .inB1(1'b1),
- .inB2(1'b1),
- .inB3(1'b1),
- .inC1(1'b0),
- .inC2(1'b1),
- .inC3(1'b0),
- .outA(out[2]),
- .outB(out[1]),
- .outC(out[0])
- );
- always @(posedge clk) begin
- if(out == 3'b100) begin
- led <= 1'b0;
- end else begin
- led <= 1'b1;
- end
- end
- endmodule
复制代码 |
|