Các bạn xem giúp mình sao dịch đoạn code này nó cứ báo lỗi hoài. Chả hiểu sao nữa
nó báo lỗi như vầy nè:
Mong các bạn giúp đỡ. Cảm ơn trước.
PHP Code:
// main module
module hello(Clk, HEX0, HEX1, HEX2, HEX3);
input Clk;
output [6:0]HEX0,HEX1,HEX2,HEX3;
reg[2:0] x;
clock1Hz a(Clk, clock);
always @(posedge clock)
begin
x = x + 1;
if (x > 3'b111) x = 0;
always @(x)
begin
case(x)
3'b000: state0 s0( HEX0, HEX1, HEX2, HEX3)
3'b001: state1 s1( HEX0, HEX1, HEX2, HEX3)
3'b010: state2 s2( HEX0, HEX1, HEX2, HEX3)
3'b011: state3 s3( HEX0, HEX1, HEX2, HEX3)
3'b100: state4 s4( HEX0, HEX1, HEX2, HEX3)
3'b101: state5 s5( HEX0, HEX1, HEX2, HEX3)
3'b110: state6 s6( HEX0, HEX1, HEX2, HEX3)
3'b111: state7 s7( HEX0, HEX1, HEX2, HEX3)
endcase
end
end
endmodule
// bo chia tan
module clock1Hz(Clk, clock1);
input Clk;
output reg clock1; // xung 1 Hz
reg [24:0]count ;
always @(posedge Clk)
begin
count = count + 1;
if (count==25000000)
begin clock1 = ~clock1;
count = 0;
end
end
endmodule
// state 0
module state0( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b1111111; //OFF
assign HEX22=7'b1111111; //OFF
assign HEX11=7'b1111111; //OFF
assign HEX00=7'b0001001; //H
endmodule
// state 1
module state1( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX0, HEX1, HEX2, HEX3;
assign HEX33=7'b1111111; //OFF
assign HEX22=7'b1111111; //OFF
assign HEX11=7'b0001001; //H
assign HEX00=7'b0000110; //E
endmodule
// state 2
module state2( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b1111111; //OFF
assign HEX22=7'b0001001; //H
assign HEX11=7'b0000110; //E
assign HEX00=7'b1000111; //L
endmodule
// state 3
module state3(HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b0001001; //H
assign HEX22=7'b0000110; //E
assign HEX11=7'b1000111; //L
assign HEX00=7'b1000111; //L
endmodule
// state 4
module state4( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b0000110; //E
assign HEX22=7'b1000111; //L
assign HEX11=7'b1000111; //L
assign HEX00=7'b1000000; //O
endmodule
// state 5
module state5( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b1000111; //L
assign HEX22=7'b1000111; //L
assign HEX11=7'b1000000; //O
assign HEX00=7'b1111111; //OFF
endmodule
// state 6
module state6( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b1000111; //L
assign HEX22=7'b1000000; //O
assign HEX11=7'b1111111; //OFF
assign HEX00=7'b1111111; //OFF
endmodule
// state 7
module state7( HEX00, HEX11, HEX22, HEX33);
output[6:0] HEX00, HEX11, HEX22, HEX33;
assign HEX33=7'b1000000; //O
assign HEX22=7'b1111111; //OFF
assign HEX11=7'b1111111; //OFF
assign HEX00=7'b1111111; //OFF
endmodule
PHP Code:
Error (10170): Verilog HDL syntax error at hello.v(12) near text "always"; expecting "end"
Error (10170): Verilog HDL syntax error at hello.v(15) near text "s0"; expecting "<=", or "="
Error (10170): Verilog HDL syntax error at hello.v(16) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(17) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(18) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(19) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(20) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(21) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(22) near text "3"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(23) near text "endcase"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(46) near text ")"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(48) near text ";"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(55) near text ")"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(57) near text ";"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(64) near text ")"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(66) near text ";"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(73) near text ")"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(75) near text ";"; expecting ":", or ","
Error (10170): Verilog HDL syntax error at hello.v(82) near text ")"; expecting ":", or ","
Comment