newbie question

F

Florian Student

Dear Comp.lang.vhdl,

I've been trying to write a simple free running 8 bit counter. Here's
the source I got so far:

// Module Declaration
module counter
(
clk, out
);
// Port Declaration
input clk;
output [7:0] out;
reg [7:0] counter;

always @(posedge clk)
begin
counter = counter + 1;
out = counter;
end

endmodule

The Quartus compiler tells me that there's an
"Error: Verilog HDL Procedural Assignment error at counter.v(21):
illegal Procedural Assignment to nonregister data type out"

What am I doing wrong?

Thanx in advance,

Florian
 
P

paris

Florian Student said:
Dear Comp.lang.vhdl,

I've been trying to write a simple free running 8 bit counter. Here's
the source I got so far:

// Module Declaration
module counter
(
clk, out
);
// Port Declaration
input clk;
output [7:0] out;
reg [7:0] counter;

always @(posedge clk)
begin
counter = counter + 1;
out = counter;
end

endmodule

The Quartus compiler tells me that there's an
"Error: Verilog HDL Procedural Assignment error at counter.v(21):
illegal Procedural Assignment to nonregister data type out"

What am I doing wrong?

Thanx in advance,

Florian

well, like you said, this is comp.lang.VHDL :) and your code is in Verilog
if you dont get the answers here you could try comp.lang.verilog
just in case, Verilog and VHDL (VHSIC HDL) are different HDLs
 
D

Dave Townsend

I believe you need to declare the output port as a register. It is
not legal in verilog to assign in a always block to a wire ( plain old
port).

dave


paris said:
Florian Student said:
Dear Comp.lang.vhdl,

I've been trying to write a simple free running 8 bit counter. Here's
the source I got so far:

// Module Declaration
module counter
(
clk, out
);
// Port Declaration
input clk;
output [7:0] out;
reg [7:0] counter;

always @(posedge clk)
begin
counter = counter + 1;
out = counter;
end

endmodule

The Quartus compiler tells me that there's an
"Error: Verilog HDL Procedural Assignment error at counter.v(21):
illegal Procedural Assignment to nonregister data type out"

What am I doing wrong?

Thanx in advance,

Florian

well, like you said, this is comp.lang.VHDL :) and your code is in Verilog
if you dont get the answers here you could try comp.lang.verilog
just in case, Verilog and VHDL (VHSIC HDL) are different HDLs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,193
Messages
2,571,025
Members
47,628
Latest member
AdrianneOt

Latest Threads

Top