vveerendra
Newbie level 5
- Joined
- Apr 2, 2013
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,358
module disp1(A,P,Q,K,CLK,bclock,bclocko);
input [3:0]P;
input [3:0]Q;
output [3:0]K;
input CLK;
output [6:0]A;
reg [6:0]A;
reg [3:0]K;
output bclock;
output bclocko;
reg bclock;
reg bclocko;
integer count=0;
integer counto=0;
if (bclock)
begin
K <= 4'b1110;
case(P)
0:A<=7'b0000001;
1:A<=7'b1001111;
2:A<=7'b0010010;
3:A<=7'b0000110;
4:A<=7'b1001100;
5:A<=7'b0100100;
6:A<=7'b0100000;
7:A<=7'b0001111;
8:A<=7'b0000000;
9:A<=7'b0001100;
endcase
end
else
begin
K<=4'b1101;
case(Q)
0:A<=7'b0000001;
1:A<=7'b1001111;
2:A<=7'b0010010;
3:A<=7'b0000110;
4:A<=7'b1001100;
5:A<=7'b0100100;
6:A<=7'b0100000;
7:A<=7'b0001111;
8:A<=7'b0000000;
9:A<=7'b0001100;
endcase
end
always @(posedge CLK)
if (count < 42666) count = count+1;
else
begin
bclock <= !bclock;
count=0;
end
endmodule
/*ERROR:line 15 expecting 'endmodule', found 'if'
how to fix the error*/
input [3:0]P;
input [3:0]Q;
output [3:0]K;
input CLK;
output [6:0]A;
reg [6:0]A;
reg [3:0]K;
output bclock;
output bclocko;
reg bclock;
reg bclocko;
integer count=0;
integer counto=0;
if (bclock)
begin
K <= 4'b1110;
case(P)
0:A<=7'b0000001;
1:A<=7'b1001111;
2:A<=7'b0010010;
3:A<=7'b0000110;
4:A<=7'b1001100;
5:A<=7'b0100100;
6:A<=7'b0100000;
7:A<=7'b0001111;
8:A<=7'b0000000;
9:A<=7'b0001100;
endcase
end
else
begin
K<=4'b1101;
case(Q)
0:A<=7'b0000001;
1:A<=7'b1001111;
2:A<=7'b0010010;
3:A<=7'b0000110;
4:A<=7'b1001100;
5:A<=7'b0100100;
6:A<=7'b0100000;
7:A<=7'b0001111;
8:A<=7'b0000000;
9:A<=7'b0001100;
endcase
end
always @(posedge CLK)
if (count < 42666) count = count+1;
else
begin
bclock <= !bclock;
count=0;
end
endmodule
/*ERROR:line 15 expecting 'endmodule', found 'if'
how to fix the error*/