N00b Q: How to assign pins to a reg?


#1

I’ve looked on line and tried many, many variations without success.

Here’s the .v file named regstore.v
module top (
input CLK,
output PIN_1, PIN_2, PIN_3, PIN_4, PIN_5, PIN_6, PIN_7, PIN_8
);

reg [7:0] store;

always@(posedge CLK) begin
    store = store + 1;
    assign PIN_1 <= store[0];
    assign PIN_2 <= store[1];
    assign PIN_3 <= store[2];
    assign PIN_4 <= store[3];
    assign PIN_5 <= store[4];
    assign PIN_6 <= store[5];
    assign PIN_7 <= store[6];
    assign PIN_8 <= store[7];
end

endmodule

While using atom on a Win10 laptop, Verification shows:
regstore.v:10 syntax error
regstore.v:10 Sntax in assignment statement l-value
.
.
.
which are the lines starting with “assign”

I am using the .pcf file that was included for my tinyFPGA BX board in the blink_project folder.

I understand that PIN_x are declared as "wire"s. But when I flip the syntax to
assign store[n] <= PIN_n;
the same error occurs.

TIA for any help!


#2

Take the assign statements out of the always block and change “<=” to “=”.

Also change store = store + 1; to store <= store + 1;, but leave that in the always block.


#3

Perfect! That builds beautifully!
Thank You!