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