|
- module cd4077( //CD4077 四组二输入端同或门 (异或非门) VCC:Pin14 GND:Pin7
- input inA1, //A组输入 Pin1
- input inA2, //A组输入 Pin2
- input inB1, //B组输入 Pin5
- input inB2, //B组输入 Pin6
- input inC1, //C组输入 Pin8
- input inC2, //C组输入 Pin9
- input inD1, //D组输入 Pin12
- input inD2, //D组输入 Pin13
- output outA, //A组输出 Pin3
- output outB, //B组输出 Pin4
- output outC, //C组输出 Pin10
- output outD //D组输出 Pin11
- );
- assign {outA,outB,outC,outD} = ~(
- {inA1,inB1,inC1,inD1} ^ {inA2,inB2,inC2,inD2}
- );
- endmodule
- module main(
- input clk,
- output reg led
- );
- wire [3:0] out;
- cd4077 U1(
- .inA1(1),
- .inA2(1),
- .inB1(1),
- .inB2(0),
- .inC1(1),
- .inC2(1),
- .inD1(1),
- .inD2(0),
- .outA(out[3]),
- .outB(out[2]),
- .outC(out[1]),
- .outD(out[0]),
- );
- always @(posedge clk) begin
- if(out == 4'b1010) begin
- led <= 1'b0;
- end else begin
- led <= 1'b1;
- end
- end
- endmodule
复制代码 |
|