Well first off don't think of Verilog code as a progrm. Verilog isn't a software language. Insstead think in terms of a schematic of a digital circuit, which you will then describe in Verilog.
Now the way you store a matrix is by using a RAM. The address is split into a row and column parts. Anrvthe memory array is defined like so.
Code:
reg [7:0] mem [0:3];
This array would be able to hold a 4x4 matrix of bytes.