Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

When I am trying to do simulation of the following program on Modelsim Altera 10.0d then gives Error : Code Error 9: ** Fatal: (vsim-4) * Memory allocation failure.

Attempting to allocate 131072 bytes

Please check your system for available memory and swap space.

The following is my code :-

module sipo (gsclk, sclk, rst, sipo_in, sipo_out, sipo_out_i, dcsel, blank, gs_enable);
   input gsclk, sclk, rst;
   input sipo_in;
   input dcsel, blank;
   output reg [47:0] sipo_out;
   output reg [47:0] sipo_out_i;
   output     gs_enable;
   integer i;

   assign  gs_enable = (~dcsel & sclk==1'b1) ? 1'b1 : 1'b0;

   always @(posedge gsclk, posedge rst)
     i=0;
   begin
     if (rst)
       sipo_out_i  <= 47'b0;
     else
       if (gs_enable)
         for (i=1; i<= 48; i=i+1)
           @(posedge sclk)
             while (i < 48)
             begin
               sipo_out_i  <= {sipo_out_i[46:0], sipo_in}; 
               i = i+1;
             end
           sipo_out <= sipo_out_i;
   end

Please help me if it requires any change in verilog code?

share|improve this question

1 Answer

Your simulator should be giving syntax errors before the memory allocation error.

The always block has many errors. First it delete the line i=0;, it is assigned in the for-loop. This allows the begin block called on the always blocks triggered events. Don't use both for-loop and while-loop. Currently both dependent on i and if the code could run you would see i go 1 to 48 with no step in between, and sip_out_i would equal {48{sipo_in}}. Assuming not what you are intending and inefficient if it is.

Having a @(...) nested statement inside another block is legal verilog, but is a bad coding style. Synthesis tools and linting tools will give errors. Nested @(...) and wait statements are more intended for the test-bench framework, and even that is mostly discouraged.

You should use two always blocks. One running on gsclk and the other on sclk. sclk should fill sipo_out_i. gsclk transfer sipo_out_i to sipo_out. Handshake signals will be needed to synchronize the two blocks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.