vvavepacket
vvavepacket

Reputation: 1929

verilog array referencing

I have this module. The question is gameArray[0][x][y-1] doesn't work. What is the correct way to perform this kind of operation? Basically it is similar to C++ syntax but can not get it to work.

module write_init_copy(
  input clk,
  input gameArray [1:0][63:0][127:0], writecell, processedcell,
  input [5:0] x,
  input [6:0] y,
  input initialize, copyover,
  output reg done_initialize, done_copy, done_writecell);

always@(posedge clk)
begin
    if(writecell == 1)
    begin
        gameArray[1][x][y] <= processedcell;
        done_writecell <= 1;
    end
    else if(initialize == 1)
    begin

    end
end

endmodule

Upvotes: 0

Views: 169

Answers (1)

Brian Magnuson
Brian Magnuson

Reputation: 1487

gameArray is declared as an input so you can't assign to it. If you want you want to modify it declare a separate 'in' and 'out' version where out <= f(in); i.e.

gameArray_out <= gameArray_in;
gameArray_out[1][x][y] <= procesedcell;

Upvotes: 2

Related Questions