OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [branches/] [verilator/] [bench/] [verilog/] [minsoc_bench_core.v] - Blame information for rev 145

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rfajardo
`include "minsoc_bench_defines.v"
2
`include "minsoc_defines.v"
3 10 rfajardo
`include "or1200_defines.v"
4 2 rfajardo
 
5 71 rfajardo
`include "timescale.v"
6
 
7 131 rfajardo
module minsoc_bench_core(
8 128 rfajardo
    clock,
9
    reset,
10
    eth_tx_clk,
11
    eth_rx_clk
12
);
13 2 rfajardo
 
14 128 rfajardo
input clock, reset, eth_tx_clk, eth_rx_clk;
15 60 rfajardo
 
16 17 rfajardo
//Debug interface
17 2 rfajardo
wire dbg_tms_i;
18
wire dbg_tck_i;
19
wire dbg_tdi_i;
20
wire dbg_tdo_o;
21
wire jtag_vref;
22
wire jtag_gnd;
23
 
24 17 rfajardo
//SPI wires
25 2 rfajardo
wire spi_mosi;
26
reg spi_miso;
27
wire spi_sclk;
28
wire [1:0] spi_ss;
29
 
30 17 rfajardo
//UART wires
31 2 rfajardo
wire uart_stx;
32 9 rfajardo
reg uart_srx;
33 2 rfajardo
 
34 17 rfajardo
//ETH wires
35
reg eth_col;
36
reg eth_crs;
37 2 rfajardo
wire eth_trst;
38
wire eth_tx_en;
39
wire eth_tx_er;
40
wire [3:0] eth_txd;
41 17 rfajardo
reg eth_rx_dv;
42
reg eth_rx_er;
43
reg [3:0] eth_rxd;
44
reg eth_fds_mdint;
45 2 rfajardo
wire eth_mdc;
46
wire eth_mdio;
47
 
48
//
49
//      TASKS registers to communicate with interfaces
50
//
51 124 rfajardo
reg design_ready;
52
reg uart_echo;
53
`ifdef UART
54
reg [40*8-1:0] line;
55
reg [12*8-1:0] hello;
56
reg new_line;
57
reg new_char;
58
`endif
59 17 rfajardo
`ifdef ETHERNET
60 28 rfajardo
reg [7:0] eth_rx_data [0:1535];            //receive buffer ETH (max packet 1536)
61 17 rfajardo
reg [7:0] eth_tx_data [0:1535];     //send buffer ETH (max packet 1536)
62
localparam ETH_HDR = 14;
63
localparam ETH_PAYLOAD_MAX_LENGTH = 1518;//only able to send up to 1536 bytes with header (14 bytes) and CRC (4 bytes)
64
`endif
65 2 rfajardo
 
66
 
67
//
68
// Testbench mechanics
69
//
70 4 rfajardo
reg [7:0] program_mem[(1<<(`MEMORY_ADR_WIDTH+2))-1:0];
71 133 rfajardo
integer initialize, ptr;
72 2 rfajardo
reg [8*64:0] file_name;
73 133 rfajardo
integer      firmware_size;  // Note that the .hex file size is greater than this, as each byte in the file needs 2 hex characters.
74
integer      firmware_size_in_header;
75 2 rfajardo
reg load_file;
76 8 rfajardo
 
77 2 rfajardo
initial begin
78 124 rfajardo
    design_ready = 1'b0;
79
    uart_echo = 1'b1;
80 28 rfajardo
 
81
`ifndef NO_CLOCK_DIVISION
82
    minsoc_top_0.clk_adjust.clk_int = 1'b0;
83
    minsoc_top_0.clk_adjust.clock_divisor = 32'h0000_0000;
84
`endif
85 17 rfajardo
 
86 11 rfajardo
    uart_srx = 1'b1;
87 17 rfajardo
 
88
        eth_col = 1'b0;
89
        eth_crs = 1'b0;
90
        eth_fds_mdint = 1'b1;
91
        eth_rx_er = 1'b0;
92
        eth_rxd = 4'h0;
93
        eth_rx_dv = 1'b0;
94
 
95 8 rfajardo
 
96 17 rfajardo
//dual and two port rams from FPGA memory instances have to be initialized to 0
97 10 rfajardo
    init_fpga_memory();
98
 
99 2 rfajardo
        load_file = 1'b0;
100
`ifdef INITIALIZE_MEMORY_MODEL
101
        load_file = 1'b1;
102
`endif
103
`ifdef START_UP
104
        load_file = 1'b1;
105
`endif
106 8 rfajardo
 
107 2 rfajardo
        //get firmware hex file from command line input
108
        if ( load_file ) begin
109
                if ( ! $value$plusargs("file_name=%s", file_name) || file_name == 0 ) begin
110 133 rfajardo
                        $display("ERROR: Please specify the name of the firmware file to load on start-up.");
111 2 rfajardo
                        $finish;
112
                end
113 133 rfajardo
 
114
        // We are passing the firmware size separately as a command-line argument in order
115
        // to avoid this kind of Icarus Verilog warnings:
116
        //   WARNING: minsoc_bench_core.v:111: $readmemh: Standard inconsistency, following 1364-2005.
117
        //   WARNING: minsoc_bench_core.v:111: $readmemh(../../sw/uart/uart.hex): Not enough words in the file for the requested range [0:32767].
118
        // Apparently, some of the $readmemh() warnigns are even required by the standard. The trouble is,
119
        // Verilog's $fread() is not widely implemented in the simulators, so from Verilog alone
120
        // it's not easy to read the firmware file header without getting such warnings.
121
                if ( ! $value$plusargs("firmware_size=%d", firmware_size) ) begin
122
                        $display("ERROR: Please specify the size of the firmware (in bytes) contained in the hex firmware file.");
123
                        $finish;
124
                end
125
 
126
                $readmemh(file_name, program_mem, 0, firmware_size - 1);
127
 
128
                firmware_size_in_header = { program_mem[0] , program_mem[1] , program_mem[2] , program_mem[3] };
129
 
130
        if ( firmware_size != firmware_size_in_header ) begin
131
                        $display("ERROR: The firmware size in the file header does not match the firmware size given as command-line argument. Did you forget bin2hex's -size_word flag when generating the firmware file?");
132
                        $finish;
133
        end
134
 
135 2 rfajardo
        end
136
 
137
`ifdef INITIALIZE_MEMORY_MODEL
138
        // Initialize memory with firmware
139
        initialize = 0;
140 123 rfajardo
        while ( initialize < firmware_size ) begin
141 2 rfajardo
                minsoc_top_0.onchip_ram_top.block_ram_3.mem[initialize/4] = program_mem[initialize];
142
                minsoc_top_0.onchip_ram_top.block_ram_2.mem[initialize/4] = program_mem[initialize+1];
143
                minsoc_top_0.onchip_ram_top.block_ram_1.mem[initialize/4] = program_mem[initialize+2];
144
                minsoc_top_0.onchip_ram_top.block_ram_0.mem[initialize/4] = program_mem[initialize+3];
145
        initialize = initialize + 4;
146
        end
147
        $display("Memory model initialized with firmware:");
148
        $display("%s", file_name);
149 123 rfajardo
        $display("%d Bytes loaded from %d ...", initialize , firmware_size);
150 2 rfajardo
`endif
151
 
152 129 rfajardo
`ifdef POSITIVE_RESET
153
    repeat(2) @ (negedge reset);
154
`elsif NEGATIVE_RESET
155
    repeat(2) @ (posedge reset);
156
`else
157
    repeat(2) @ (negedge reset);
158
`endif
159
 
160 2 rfajardo
`ifdef START_UP
161
        // Pass firmware over spi to or1k_startup
162
        ptr = 0;
163
        //read dummy
164
        send_spi(program_mem[ptr]);
165
        send_spi(program_mem[ptr]);
166
        send_spi(program_mem[ptr]);
167
        send_spi(program_mem[ptr]);
168
        //~read dummy
169 123 rfajardo
        while ( ptr < firmware_size ) begin
170 2 rfajardo
                send_spi(program_mem[ptr]);
171
                ptr = ptr + 1;
172
        end
173
        $display("Memory start-up completed...");
174
        $display("Loaded firmware:");
175
        $display("%s", file_name);
176
`endif
177 17 rfajardo
 
178
 
179 2 rfajardo
        //
180
    // Testbench START
181
        //
182 124 rfajardo
    design_ready = 1'b1;
183 125 rfajardo
    $display("Running simulation: if you want to stop it, type ctrl+c and type in finish afterwards.");
184 17 rfajardo
    fork
185
        begin
186 125 rfajardo
`ifdef UART
187 124 rfajardo
 
188 125 rfajardo
`ifdef ETHERNET
189
`ifdef TEST_ETHERNET
190 126 rfajardo
            $display("Testing Ethernet firmware, this takes long (~15 min. @ 2.53 GHz dual-core)...");
191 125 rfajardo
            $display("Ethernet firmware encloses UART firmware, testing UART firmware first...");
192
            test_uart();
193
            test_eth();
194 124 rfajardo
            $display("Stopping simulation.");
195
            $finish;
196 125 rfajardo
`endif
197
`endif
198
 
199
`ifdef TEST_UART
200
            $display("Testing UART firmware, this takes a while (~1 min. @ 2.53 GHz dual-core)...");
201
            test_uart();
202 124 rfajardo
            $display("Stopping simulation.");
203
            $finish;
204 125 rfajardo
`endif
205
 
206 124 rfajardo
`endif
207 17 rfajardo
        end
208 124 rfajardo
        begin
209 125 rfajardo
`ifdef ETHERNET
210 124 rfajardo
`ifdef TEST_ETHERNET
211
            get_mac();
212
            if ( { eth_rx_data[ETH_HDR] , eth_rx_data[ETH_HDR+1] , eth_rx_data[ETH_HDR+2] , eth_rx_data[ETH_HDR+3] } == 32'hFF2B4050 )
213
                $display("Ethernet firmware started correctly.");
214
`endif
215 125 rfajardo
`endif
216 124 rfajardo
        end
217 17 rfajardo
    join
218 2 rfajardo
 
219
end
220
 
221
 
222
//
223
// Modules instantiations
224
//
225
minsoc_top minsoc_top_0(
226
   .clk(clock),
227
   .reset(reset)
228
 
229
   //JTAG ports
230
`ifdef GENERIC_TAP
231
   , .jtag_tdi(dbg_tdi_i),
232
   .jtag_tms(dbg_tms_i),
233
   .jtag_tck(dbg_tck_i),
234
   .jtag_tdo(dbg_tdo_o),
235
   .jtag_vref(jtag_vref),
236
   .jtag_gnd(jtag_gnd)
237
`endif
238
 
239
   //SPI ports
240
`ifdef START_UP
241
   , .spi_flash_mosi(spi_mosi),
242
   .spi_flash_miso(spi_miso),
243
   .spi_flash_sclk(spi_sclk),
244
   .spi_flash_ss(spi_ss)
245
`endif
246
 
247
   //UART ports
248
`ifdef UART
249
   , .uart_stx(uart_stx),
250
   .uart_srx(uart_srx)
251
`endif // !UART
252
 
253
        // Ethernet ports
254
`ifdef ETHERNET
255
        , .eth_col(eth_col),
256
    .eth_crs(eth_crs),
257
    .eth_trste(eth_trst),
258
    .eth_tx_clk(eth_tx_clk),
259
        .eth_tx_en(eth_tx_en),
260
    .eth_tx_er(eth_tx_er),
261
    .eth_txd(eth_txd),
262
    .eth_rx_clk(eth_rx_clk),
263
        .eth_rx_dv(eth_rx_dv),
264
    .eth_rx_er(eth_rx_er),
265
    .eth_rxd(eth_rxd),
266
    .eth_fds_mdint(eth_fds_mdint),
267
        .eth_mdc(eth_mdc),
268
    .eth_mdio(eth_mdio)
269
`endif // !ETHERNET
270
);
271
 
272
`ifdef VPI_DEBUG
273
        dbg_comm_vpi dbg_if(
274
                .SYS_CLK(clock),
275
                .P_TMS(dbg_tms_i),
276
                .P_TCK(dbg_tck_i),
277
                .P_TRST(),
278
                .P_TDI(dbg_tdi_i),
279
                .P_TDO(dbg_tdo_o)
280
        );
281
`else
282
   assign dbg_tdi_i = 1;
283
   assign dbg_tck_i = 0;
284
   assign dbg_tms_i = 1;
285
`endif
286
 
287
 
288
//
289 125 rfajardo
// Firmware testers
290
//
291 131 rfajardo
`ifdef UART
292 125 rfajardo
task test_uart();
293
    begin
294
            @ (posedge new_line);
295
            $display("UART data received.");
296
            hello = line[12*8-1:0];
297
            //sending character A to UART, B expected
298
            $display("Testing UART interrupt...");
299
            uart_echo = 1'b0;
300
            uart_send(8'h41);       //Character A
301
            @ (posedge new_char);
302
            if ( line[7:0] == "B" )
303
                $display("UART interrupt working.");
304
            else
305
                $display("UART interrupt failed.");
306
            uart_echo = 1'b1;
307
 
308
            if ( hello == "Hello World." )
309 128 rfajardo
                $display("UART firmware test completed, behaving correctly.");
310 125 rfajardo
            else
311
                $display("UART firmware test completed, failed.");
312
    end
313
endtask
314 131 rfajardo
`endif
315 125 rfajardo
 
316 130 rfajardo
`ifdef ETHERNET
317 125 rfajardo
task test_eth();
318
    begin
319
                eth_tx_data[ETH_HDR+0] = 8'hBA;
320
                eth_tx_data[ETH_HDR+1] = 8'h87;
321
                eth_tx_data[ETH_HDR+2] = 8'hAA;
322
                eth_tx_data[ETH_HDR+3] = 8'hBB;
323
                eth_tx_data[ETH_HDR+4] = 8'hCC;
324
                eth_tx_data[ETH_HDR+5] = 8'hDD;
325
 
326
            $display("Sending an Ethernet package to the system and waiting for the data to be output through UART...");
327
                send_mac(6);
328
            repeat(3+40) @ (posedge new_line);
329
            $display("Ethernet test completed.");
330
    end
331
endtask
332 130 rfajardo
`endif
333 125 rfajardo
 
334
 
335 2 rfajardo
`ifdef VCD_OUTPUT
336
initial begin
337
        $dumpfile("../results/minsoc_wave.vcd");
338
        $dumpvars();
339
end
340
`endif
341
 
342
 
343
//
344
//      Functionalities tasks: SPI Startup and UART Monitor
345
//
346
//SPI START_UP
347
`ifdef START_UP
348 28 rfajardo
task send_spi;
349
    input [7:0] data_in;
350
    integer i;
351 2 rfajardo
    begin
352 28 rfajardo
        i = 7;
353
        for ( i = 7 ; i >= 0; i = i - 1 ) begin
354 2 rfajardo
                spi_miso = data_in[i];
355 28 rfajardo
                        @ (posedge spi_sclk);
356
            end
357
    end
358 2 rfajardo
endtask
359
`endif
360
//~SPI START_UP
361
 
362 17 rfajardo
//UART
363 2 rfajardo
`ifdef UART
364 124 rfajardo
localparam UART_TX_WAIT = (`FREQ / `UART_BAUDRATE);
365 2 rfajardo
 
366 17 rfajardo
task uart_send;
367
    input [7:0] data;
368
    integer i;
369
    begin
370
        uart_srx = 1'b0;
371 124 rfajardo
        repeat (UART_TX_WAIT) @ (posedge clock);
372 17 rfajardo
        for ( i = 0; i < 8 ; i = i + 1 ) begin
373
                    uart_srx = data[i];
374 124 rfajardo
            repeat (UART_TX_WAIT) @ (posedge clock);
375 17 rfajardo
            end
376
        uart_srx = 1'b0;
377 124 rfajardo
        repeat (UART_TX_WAIT) @ (posedge clock);
378 17 rfajardo
            uart_srx = 1'b1;
379
    end
380
endtask
381
 
382
//UART Monitor (prints uart output on the terminal)
383 2 rfajardo
// Something to trigger the task
384 124 rfajardo
initial
385
begin
386
    new_line = 1'b0;
387
    new_char = 1'b0;
388
end
389 2 rfajardo
 
390 124 rfajardo
always @ (posedge clock)
391
    if ( design_ready )
392
        uart_decoder;
393
 
394 2 rfajardo
task uart_decoder;
395
        integer i;
396
        reg [7:0] tx_byte;
397
        begin
398 124 rfajardo
        new_char = 1'b0;
399
        // Wait for start bit
400
        while (uart_stx == 1'b1)
401
        @(uart_stx);
402 2 rfajardo
 
403 124 rfajardo
        repeat (UART_TX_WAIT+(UART_TX_WAIT/2)) @ (posedge clock);
404 2 rfajardo
 
405 124 rfajardo
        for ( i = 0; i < 8 ; i = i + 1 ) begin
406
            tx_byte[i] = uart_stx;
407
            repeat (UART_TX_WAIT) @ (posedge clock);
408
        end
409 2 rfajardo
 
410 124 rfajardo
        //Check for stop bit
411
        if (uart_stx == 1'b0) begin
412
            //$display("* WARNING: user stop bit not received when expected at time %d__", $time);
413
            // Wait for return to idle
414
            while (uart_stx == 1'b0)
415
            @(uart_stx);
416
            //$display("* USER UART returned to idle at time %d",$time);
417
        end
418
        // display the char
419
        new_char = 1'b1;
420
        if ( uart_echo )
421
            $write("%c", tx_byte);
422
        if ( new_line )
423
            line = "";
424
        if ( tx_byte == "\n" )
425
            new_line = 1'b1;
426
        else begin
427
            line = { line[39*8-1:0], tx_byte};
428
            new_line = 1'b0;
429
        end
430
    end
431 2 rfajardo
endtask
432 17 rfajardo
//~UART Monitor
433 2 rfajardo
`endif // !UART
434 17 rfajardo
//~UART
435 2 rfajardo
 
436
 
437
//
438
//      TASKS to communicate with interfaces
439
//
440 28 rfajardo
//MAC_DATA
441 2 rfajardo
//
442 28 rfajardo
`ifdef ETHERNET
443 17 rfajardo
reg [31:0] crc32_result;
444 28 rfajardo
 
445
task get_mac;
446
    integer conta;
447
    reg LSB;
448
    begin
449
        conta = 0;
450
        LSB = 1;
451 17 rfajardo
        @ ( posedge eth_tx_en);
452
 
453
        repeat (16) @ (negedge eth_tx_clk);  //8 bytes, preamble (7 bytes) + start of frame (1 byte)
454 28 rfajardo
 
455
        while ( eth_tx_en == 1'b1 ) begin
456
            @ (negedge eth_tx_clk) begin
457
                if ( LSB == 1'b1 )
458
                    eth_rx_data[conta][3:0] = eth_txd;
459
                else begin
460
                    eth_rx_data[conta][7:4] = eth_txd;
461
                    conta = conta + 1;
462
                end
463
                LSB = ~LSB;
464
            end
465
        end
466
    end
467
endtask
468
 
469 17 rfajardo
task send_mac;              //only able to send up to 1536 bytes with header (14 bytes) and CRC (4 bytes)
470 28 rfajardo
    input [31:0] length;    //ETH_PAYLOAD_MAX_LENGTH 1518
471
    integer conta;
472 17 rfajardo
    begin
473 28 rfajardo
        if ( length <= ETH_PAYLOAD_MAX_LENGTH ) begin
474
            //DEST MAC
475
            eth_tx_data[0] = 8'h55;
476
            eth_tx_data[1] = 8'h47;
477
            eth_tx_data[2] = 8'h34;
478
            eth_tx_data[3] = 8'h22;
479
            eth_tx_data[4] = 8'h88;
480
            eth_tx_data[5] = 8'h92;
481
 
482
            //SOURCE MAC
483
            eth_tx_data[6] = 8'h3D;
484
            eth_tx_data[7] = 8'h4F;
485
            eth_tx_data[8] = 8'h1A;
486
            eth_tx_data[9] = 8'hBE;
487
            eth_tx_data[10] = 8'h68;
488
            eth_tx_data[11] = 8'h72;
489
 
490
            //LEN
491
            eth_tx_data[12] = length[7:4];
492
            eth_tx_data[13] = length[3:0];
493
 
494
            //DATA input by task caller
495
 
496
            //PAD
497
            for ( conta = length+14; conta < 60; conta = conta + 1 ) begin
498
                eth_tx_data[conta] = 8'h00;
499
            end
500
 
501
            gencrc32(conta);
502
 
503
            eth_tx_data[conta] = crc32_result[31:24];
504
            eth_tx_data[conta+1] = crc32_result[23:16];
505
            eth_tx_data[conta+2] = crc32_result[15:8];
506
            eth_tx_data[conta+3] = crc32_result[7:0];
507
 
508 17 rfajardo
            send_rx_packet( 64'h0055_5555_5555_5555, 4'h7, 8'hD5, 32'h0000_0000, conta+4, 1'b0 );
509
        end
510
        else
511 28 rfajardo
            $display("Warning: Ethernet packet is to big to be sent.");
512
    end
513 17 rfajardo
 
514 28 rfajardo
endtask
515
 
516 17 rfajardo
task send_rx_packet;
517
  input  [(8*8)-1:0] preamble_data; // preamble data to be sent - correct is 64'h0055_5555_5555_5555
518
  input   [3:0] preamble_len; // length of preamble in bytes - max is 4'h8, correct is 4'h7 
519
  input   [7:0] sfd_data; // SFD data to be sent - correct is 8'hD5
520
  input  [31:0] start_addr; // start address
521
  input  [31:0] len; // length of frame in Bytes (without preamble and SFD)
522
  input         plus_drible_nibble; // if length is longer for one nibble
523
  integer       rx_cnt;
524
  reg    [31:0] eth_tx_data_addr_in; // address for reading from RX memory       
525
  reg     [7:0] eth_tx_data_data_out; // data for reading from RX memory
526
begin
527
      @(posedge eth_rx_clk);
528 124 rfajardo
       eth_rx_dv = 1;
529 17 rfajardo
 
530
      // set initial rx memory address
531
      eth_tx_data_addr_in = start_addr;
532
 
533
      // send preamble
534
      for (rx_cnt = 0; (rx_cnt < (preamble_len << 1)) && (rx_cnt < 16); rx_cnt = rx_cnt + 1)
535
      begin
536 124 rfajardo
         eth_rxd = preamble_data[3:0];
537
         preamble_data = preamble_data >> 4;
538 17 rfajardo
        @(posedge eth_rx_clk);
539
      end
540
 
541
      // send SFD
542
      for (rx_cnt = 0; rx_cnt < 2; rx_cnt = rx_cnt + 1)
543
      begin
544 124 rfajardo
         eth_rxd = sfd_data[3:0];
545
         sfd_data = sfd_data >> 4;
546 17 rfajardo
        @(posedge eth_rx_clk);
547
      end
548
 
549
      // send packet's addresses, type/length, data and FCS
550
      for (rx_cnt = 0; rx_cnt < len; rx_cnt = rx_cnt + 1)
551
      begin
552
        eth_tx_data_data_out = eth_tx_data[eth_tx_data_addr_in[21:0]];
553
        eth_rxd = eth_tx_data_data_out[3:0];
554
        @(posedge eth_rx_clk);
555
        eth_rxd = eth_tx_data_data_out[7:4];
556
        eth_tx_data_addr_in = eth_tx_data_addr_in + 1;
557
        @(posedge eth_rx_clk);
558
      end
559
      if (plus_drible_nibble)
560
      begin
561
        eth_tx_data_data_out = eth_tx_data[eth_tx_data_addr_in[21:0]];
562
        eth_rxd = eth_tx_data_data_out[3:0];
563
        @(posedge eth_rx_clk);
564
      end
565
 
566 124 rfajardo
       eth_rx_dv = 0;
567 17 rfajardo
      @(posedge eth_rx_clk);
568
 
569
end
570
endtask // send_rx_packet
571 28 rfajardo
 
572
//CRC32
573
localparam [31:0] CRC32_POLY = 32'h04C11DB7;
574
 
575 17 rfajardo
task gencrc32;
576
    input [31:0] crc32_length;
577 28 rfajardo
 
578
    integer     byte, bit;
579
    reg         msb;
580
    reg [7:0]    current_byte;
581
    reg [31:0]   temp;
582
 
583
    begin
584
        crc32_result = 32'hffffffff;
585
        for (byte = 0; byte < crc32_length; byte = byte + 1) begin
586
            current_byte = eth_tx_data[byte];
587
            for (bit = 0; bit < 8; bit = bit + 1) begin
588
                msb = crc32_result[31];
589
                crc32_result = crc32_result << 1;
590
                if (msb != current_byte[bit]) begin
591
                    crc32_result = crc32_result ^ CRC32_POLY;
592
                    crc32_result[0] = 1;
593
                end
594
            end
595
        end
596
 
597
        // Last step is to "mirror" every bit, swap the 4 bytes, and then complement each bit.
598
        //
599
        // Mirror:
600
        for (bit = 0; bit < 32; bit = bit + 1)
601
            temp[31-bit] = crc32_result[bit];
602
 
603
        // Swap and Complement:
604
        crc32_result = ~{temp[7:0], temp[15:8], temp[23:16], temp[31:24]};
605
    end
606
endtask
607 17 rfajardo
//~CRC32
608
 
609 28 rfajardo
`endif // !ETHERNET
610 2 rfajardo
//~MAC_DATA
611
 
612
 
613 10 rfajardo
 
614
//
615
// TASK to initialize instantiated FPGA dual and two port memory to 0
616
//
617
task init_fpga_memory;
618
    integer i;
619
    begin
620
`ifdef OR1200_RFRAM_TWOPORT
621
`ifdef OR1200_XILINX_RAMB4
622
    for ( i = 0; i < (1<<8); i = i + 1 ) begin
623
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.ramb4_s16_s16_0.mem[i] = 16'h0000;
624
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.ramb4_s16_s16_1.mem[i] = 16'h0000;
625
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.ramb4_s16_s16_0.mem[i] = 16'h0000;
626
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.ramb4_s16_s16_1.mem[i] = 16'h0000;
627
    end
628
`elsif OR1200_XILINX_RAMB16
629
    for ( i = 0; i < (1<<9); i = i + 1 ) begin
630
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.ramb16_s36_s36.mem[i] = 32'h0000_0000;
631
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.ramb16_s36_s36.mem[i] = 32'h0000_0000;
632
    end
633
`elsif OR1200_ALTERA_LPM
634
`ifndef OR1200_ALTERA_LPM_XXX
635
    $display("Definition OR1200_ALTERA_LPM in or1200_defines.v does not enable ALTERA memory for neither DUAL nor TWO port RFRAM");
636
    $display("It uses GENERIC memory instead.");
637
    $display("Add '`define OR1200_ALTERA_LPM_XXX' under '`define OR1200_ALTERA_LPM' on or1200_defines.v to use ALTERA memory.");
638
`endif
639
`ifdef OR1200_ALTERA_LPM_XXX
640
    $display("...Using ALTERA memory for TWOPORT RFRAM!");
641
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
642
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.altqpram_component.mem[i] = 32'h0000_0000;
643
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.altqpram_component.mem[i] = 32'h0000_0000;
644
    end
645
`else
646
    $display("...Using GENERIC memory!");
647
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
648
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.mem[i] = 32'h0000_0000;
649
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.mem[i] = 32'h0000_0000;
650
    end
651
`endif
652
`elsif OR1200_XILINX_RAM32X1D
653
    $display("Definition OR1200_XILINX_RAM32X1D in or1200_defines.v does not enable FPGA memory for TWO port RFRAM");
654
    $display("It uses GENERIC memory instead.");
655
    $display("FPGA memory can be used if you choose OR1200_RFRAM_DUALPORT");
656
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
657
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.mem[i] = 32'h0000_0000;
658
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.mem[i] = 32'h0000_0000;
659
    end
660
`else
661
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
662
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.mem[i] = 32'h0000_0000;
663
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.mem[i] = 32'h0000_0000;
664
    end
665
`endif
666
`elsif OR1200_RFRAM_DUALPORT
667
`ifdef OR1200_XILINX_RAMB4
668
    for ( i = 0; i < (1<<8); i = i + 1 ) begin
669
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.ramb4_s16_0.mem[i] = 16'h0000;
670
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.ramb4_s16_1.mem[i] = 16'h0000;
671
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.ramb4_s16_0.mem[i] = 16'h0000;
672
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.ramb4_s16_1.mem[i] = 16'h0000;
673
    end
674
`elsif OR1200_XILINX_RAMB16
675
    for ( i = 0; i < (1<<9); i = i + 1 ) begin
676
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.ramb16_s36_s36.mem[i] = 32'h0000_0000;
677
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.ramb16_s36_s36.mem[i] = 32'h0000_0000;
678
    end
679
`elsif OR1200_ALTERA_LPM
680
`ifndef OR1200_ALTERA_LPM_XXX
681
    $display("Definition OR1200_ALTERA_LPM in or1200_defines.v does not enable ALTERA memory for neither DUAL nor TWO port RFRAM");
682
    $display("It uses GENERIC memory instead.");
683
    $display("Add '`define OR1200_ALTERA_LPM_XXX' under '`define OR1200_ALTERA_LPM' on or1200_defines.v to use ALTERA memory.");
684
`endif
685
`ifdef OR1200_ALTERA_LPM_XXX
686
    $display("...Using ALTERA memory for DUALPORT RFRAM!");
687
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
688
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.altqpram_component.mem[i] = 32'h0000_0000;
689
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.altqpram_component.mem[i] = 32'h0000_0000;
690
    end
691
`else
692
    $display("...Using GENERIC memory!");
693
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
694
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.mem[i] = 32'h0000_0000;
695
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.mem[i] = 32'h0000_0000;
696
    end
697
`endif
698
`elsif OR1200_XILINX_RAM32X1D
699
`ifdef OR1200_USE_RAM16X1D_FOR_RAM32X1D
700
    for ( i = 0; i < (1<<4); i = i + 1 ) begin
701
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_0.mem[i] = 1'b0;
702
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_1.mem[i] = 1'b0;
703
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_2.mem[i] = 1'b0;
704
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_3.mem[i] = 1'b0;
705
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_4.mem[i] = 1'b0;
706
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_5.mem[i] = 1'b0;
707
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_6.mem[i] = 1'b0;
708
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0_7.mem[i] = 1'b0;
709
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_0.mem[i] = 1'b0;
710
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_1.mem[i] = 1'b0;
711
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_2.mem[i] = 1'b0;
712
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_3.mem[i] = 1'b0;
713
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_4.mem[i] = 1'b0;
714
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_5.mem[i] = 1'b0;
715
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_6.mem[i] = 1'b0;
716
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1_7.mem[i] = 1'b0;
717
 
718
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_0.mem[i] = 1'b0;
719
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_1.mem[i] = 1'b0;
720
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_2.mem[i] = 1'b0;
721
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_3.mem[i] = 1'b0;
722
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_4.mem[i] = 1'b0;
723
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_5.mem[i] = 1'b0;
724
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_6.mem[i] = 1'b0;
725
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0_7.mem[i] = 1'b0;
726
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_0.mem[i] = 1'b0;
727
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_1.mem[i] = 1'b0;
728
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_2.mem[i] = 1'b0;
729
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_3.mem[i] = 1'b0;
730
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_4.mem[i] = 1'b0;
731
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_5.mem[i] = 1'b0;
732
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_6.mem[i] = 1'b0;
733
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1_7.mem[i] = 1'b0;
734
 
735
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_0.mem[i] = 1'b0;
736
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_1.mem[i] = 1'b0;
737
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_2.mem[i] = 1'b0;
738
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_3.mem[i] = 1'b0;
739
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_4.mem[i] = 1'b0;
740
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_5.mem[i] = 1'b0;
741
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_6.mem[i] = 1'b0;
742
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0_7.mem[i] = 1'b0;
743
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_0.mem[i] = 1'b0;
744
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_1.mem[i] = 1'b0;
745
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_2.mem[i] = 1'b0;
746
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_3.mem[i] = 1'b0;
747
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_4.mem[i] = 1'b0;
748
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_5.mem[i] = 1'b0;
749
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_6.mem[i] = 1'b0;
750
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1_7.mem[i] = 1'b0;
751
 
752
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_0.mem[i] = 1'b0;
753
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_1.mem[i] = 1'b0;
754
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_2.mem[i] = 1'b0;
755
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_3.mem[i] = 1'b0;
756
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_4.mem[i] = 1'b0;
757
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_5.mem[i] = 1'b0;
758
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_6.mem[i] = 1'b0;
759
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0_7.mem[i] = 1'b0;
760
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_0.mem[i] = 1'b0;
761
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_1.mem[i] = 1'b0;
762
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_2.mem[i] = 1'b0;
763
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_3.mem[i] = 1'b0;
764
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_4.mem[i] = 1'b0;
765
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_5.mem[i] = 1'b0;
766
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_6.mem[i] = 1'b0;
767
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1_7.mem[i] = 1'b0;
768
 
769
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_0.mem[i] = 1'b0;
770
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_1.mem[i] = 1'b0;
771
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_2.mem[i] = 1'b0;
772
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_3.mem[i] = 1'b0;
773
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_4.mem[i] = 1'b0;
774
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_5.mem[i] = 1'b0;
775
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_6.mem[i] = 1'b0;
776
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0_7.mem[i] = 1'b0;
777
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_0.mem[i] = 1'b0;
778
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_1.mem[i] = 1'b0;
779
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_2.mem[i] = 1'b0;
780
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_3.mem[i] = 1'b0;
781
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_4.mem[i] = 1'b0;
782
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_5.mem[i] = 1'b0;
783
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_6.mem[i] = 1'b0;
784
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1_7.mem[i] = 1'b0;
785
 
786
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_0.mem[i] = 1'b0;
787
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_1.mem[i] = 1'b0;
788
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_2.mem[i] = 1'b0;
789
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_3.mem[i] = 1'b0;
790
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_4.mem[i] = 1'b0;
791
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_5.mem[i] = 1'b0;
792
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_6.mem[i] = 1'b0;
793
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0_7.mem[i] = 1'b0;
794
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_0.mem[i] = 1'b0;
795
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_1.mem[i] = 1'b0;
796
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_2.mem[i] = 1'b0;
797
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_3.mem[i] = 1'b0;
798
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_4.mem[i] = 1'b0;
799
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_5.mem[i] = 1'b0;
800
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_6.mem[i] = 1'b0;
801
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1_7.mem[i] = 1'b0;
802
 
803
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_0.mem[i] = 1'b0;
804
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_1.mem[i] = 1'b0;
805
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_2.mem[i] = 1'b0;
806
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_3.mem[i] = 1'b0;
807
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_4.mem[i] = 1'b0;
808
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_5.mem[i] = 1'b0;
809
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_6.mem[i] = 1'b0;
810
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0_7.mem[i] = 1'b0;
811
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_0.mem[i] = 1'b0;
812
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_1.mem[i] = 1'b0;
813
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_2.mem[i] = 1'b0;
814
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_3.mem[i] = 1'b0;
815
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_4.mem[i] = 1'b0;
816
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_5.mem[i] = 1'b0;
817
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_6.mem[i] = 1'b0;
818
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1_7.mem[i] = 1'b0;
819
 
820
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_0.mem[i] = 1'b0;
821
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_1.mem[i] = 1'b0;
822
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_2.mem[i] = 1'b0;
823
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_3.mem[i] = 1'b0;
824
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_4.mem[i] = 1'b0;
825
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_5.mem[i] = 1'b0;
826
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_6.mem[i] = 1'b0;
827
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0_7.mem[i] = 1'b0;
828
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_0.mem[i] = 1'b0;
829
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_1.mem[i] = 1'b0;
830
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_2.mem[i] = 1'b0;
831
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_3.mem[i] = 1'b0;
832
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_4.mem[i] = 1'b0;
833
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_5.mem[i] = 1'b0;
834
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_6.mem[i] = 1'b0;
835
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1_7.mem[i] = 1'b0;
836
    end
837
`else
838
    for ( i = 0; i < (1<<4); i = i + 1 ) begin
839
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_0.mem[i] = 1'b0;
840
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_1.mem[i] = 1'b0;
841
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_2.mem[i] = 1'b0;
842
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_3.mem[i] = 1'b0;
843
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_4.mem[i] = 1'b0;
844
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_5.mem[i] = 1'b0;
845
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_6.mem[i] = 1'b0;
846
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_0.ram32x1d_7.mem[i] = 1'b0;
847
 
848
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_0.mem[i] = 1'b0;
849
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_1.mem[i] = 1'b0;
850
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_2.mem[i] = 1'b0;
851
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_3.mem[i] = 1'b0;
852
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_4.mem[i] = 1'b0;
853
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_5.mem[i] = 1'b0;
854
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_6.mem[i] = 1'b0;
855
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_1.ram32x1d_7.mem[i] = 1'b0;
856
 
857
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_0.mem[i] = 1'b0;
858
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_1.mem[i] = 1'b0;
859
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_2.mem[i] = 1'b0;
860
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_3.mem[i] = 1'b0;
861
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_4.mem[i] = 1'b0;
862
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_5.mem[i] = 1'b0;
863
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_6.mem[i] = 1'b0;
864
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_2.ram32x1d_7.mem[i] = 1'b0;
865
 
866
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_0.mem[i] = 1'b0;
867
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_1.mem[i] = 1'b0;
868
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_2.mem[i] = 1'b0;
869
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_3.mem[i] = 1'b0;
870
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_4.mem[i] = 1'b0;
871
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_5.mem[i] = 1'b0;
872
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_6.mem[i] = 1'b0;
873
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.xcv_ram32x8d_3.ram32x1d_7.mem[i] = 1'b0;
874
 
875
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_0.mem[i] = 1'b0;
876
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_1.mem[i] = 1'b0;
877
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_2.mem[i] = 1'b0;
878
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_3.mem[i] = 1'b0;
879
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_4.mem[i] = 1'b0;
880
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_5.mem[i] = 1'b0;
881
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_6.mem[i] = 1'b0;
882
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_0.ram32x1d_7.mem[i] = 1'b0;
883
 
884
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_0.mem[i] = 1'b0;
885
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_1.mem[i] = 1'b0;
886
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_2.mem[i] = 1'b0;
887
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_3.mem[i] = 1'b0;
888
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_4.mem[i] = 1'b0;
889
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_5.mem[i] = 1'b0;
890
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_6.mem[i] = 1'b0;
891
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_1.ram32x1d_7.mem[i] = 1'b0;
892
 
893
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_0.mem[i] = 1'b0;
894
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_1.mem[i] = 1'b0;
895
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_2.mem[i] = 1'b0;
896
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_3.mem[i] = 1'b0;
897
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_4.mem[i] = 1'b0;
898
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_5.mem[i] = 1'b0;
899
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_6.mem[i] = 1'b0;
900
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_2.ram32x1d_7.mem[i] = 1'b0;
901
 
902
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_0.mem[i] = 1'b0;
903
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_1.mem[i] = 1'b0;
904
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_2.mem[i] = 1'b0;
905
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_3.mem[i] = 1'b0;
906
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_4.mem[i] = 1'b0;
907
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_5.mem[i] = 1'b0;
908
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_6.mem[i] = 1'b0;
909
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.xcv_ram32x8d_3.ram32x1d_7.mem[i] = 1'b0;
910
    end
911
`endif
912
`else
913
    for ( i = 0; i < (1<<5); i = i + 1 ) begin
914
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_a.mem[i] = 32'h0000_0000;
915
        minsoc_top_0.or1200_top.or1200_cpu.or1200_rf.rf_b.mem[i] = 32'h0000_0000;
916
    end
917
`endif
918
`endif
919
    end
920
endtask
921
 
922 2 rfajardo
endmodule
923
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.