|
- module hc04( //74HC04 六非门反相器 VCC:Pin14 GND:Pin7
- input in1, //Pin1
- input in2, //Pin3
- input in3, //Pin5
- input in4, //Pin13
- input in5, //Pin11
- input in6, //Pin9
- output out1, //Pin2
- output out2, //Pin4
- output out3, //Pin6
- output out4, //Pin12
- output out5, //Pin10
- output out6 //Pin8
-
- );
- assign {out1,out2,out3,out4,out5,out6} = ~{
- in1,in2,in3,in4,in5,in6
- };
- endmodule
- module main(
- input clk,
- output reg led
- );
- wire [5:0] out;
- hc04 hc04(
- .in1(1'b1),
- .in2(1'b0),
- .in3(1'b1),
- .in4(1'b0),
- .in5(1'b1),
- .in6(1'b0),
- .out1(out[0]),
- .out2(out[1]),
- .out3(out[2]),
- .out4(out[3]),
- .out5(out[4]),
- .out6(out[5])
- );
- always @(posedge clk) begin
- if(out == 6'b101010) begin
- led = 0;
- end else begin
- led = 1;
- end
- end
- endmodule
复制代码 |
|