I have written a code for N*N matrix multiplication . I tried to run and received no errors but when I include $display to display multiplied matrix the sim gets hung at display line . How to resolve this bug and what was causing it?

`define N 3 module two_matrix(); reg [((`N*`N)*8)-1:0] a ; reg [((`N*`N)*8)-1:0] b ; reg [((`N*`N)*8)-1:0] mul ; reg [7:0] a1 [0:`N-1][0:`N-1]; reg [7:0] b1 [0:`N-1] [0:`N-1]; reg [7:0] mul1 [0:`N-1][0:`N-1]; integer i,j,k,p,q,m,n,o,f,g,h,z,x,y,v,u; integer bb; initial begin //input [31:0] b ; //output reg [31:0] mul; a={8'd1,8'd2,8'd3,8'd4,8'd1,8'd2,8'd3,8'd4,8'd5}; b={8'd1,8'd2,8'd3,8'd4,8'd1,8'd2,8'd3,8'd4,8'd5}; i=0; j=0; k=0; p=0; q=0; m=0; n=0; o=0; f=0; g=0; z=0; y=0; x=0; v=0; h=0; for(i=0;i<`N;i=i+1) for(j=0;j<`N;j=j+1) begin {a1[i][j]}=a[8*p+:8]; p=p+1; end for(m=0;m<`N;m=m+1) for(n=0;n<`N;j=n+1) begin {a1[m][n]}=a[8*q+:8]; q=q+1; end // {b1[0][0],b1[0][1],b1[1][0],b1[1][1]}=b; for(o=0;o<`N;o=o+1) for(u=0;u<`N;u=u+1) begin {mul1[o][u]}='d0; end // for(o=0;o<N;o=o+1) // mul(o)=(N*8)'b0; // // //{mul1[0][0],mul1[0][1],mul1[1][0],mul1[1][1]}='d0; for(z=0;z<`N;z=z+1) for(x=0;x<`N;x=x+1) for(y=0;y<`N;y=y+1) begin mul1[z][x]=mul1[z][x]+(a1[z][y]*b1[y][x]); bb=mul1[z][x]; $display("%d",bb); //SIM gets hung here end // mul={mul1[0][0],mul1[0][1],mul1[1][0],mul1[1][1]}; //mul={mul1[0][0],mul1[0][1],mul1[1][0],mul1[1][1]}; // // // // $display("%d",mul1[0][0]); // //#20; // for(f=0;f<`N;f=f+1) // for(h=0;h<`N;h=h+1) // $display("%d",mul1[f][h]); //mul[8*v+:8]=mul1[f][h]; //v=v+1; end // $display("%p",mul1); endmodule