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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [xilinx/] [ml501/] [bench/] [verilog/] [include/] [ddr2_model_preload.v] - Blame information for rev 415

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 412 julius
// File intended to be included in the generate statement for each DDR2 part.
2
// The following loads a vmem file, "sram.vmem" by default, into the SDRAM.
3
 
4
// Wait until the DDR memory is initialised, and then magically
5
// load it
6
@(posedge dut.xilinx_ddr2_0.xilinx_ddr2_if0.phy_init_done);
7
//$display("%t: Loading DDR2",$time);
8
 
9
$readmemh("sram.vmem", program_array);
10
/* Now dish it out to the DDR2 model's memory */
11
for(ram_ptr = 0 ; ram_ptr < 4096 ; ram_ptr = ram_ptr + 1)
12
  begin
13
 
14
     // Construct the burst line, with every second word from where we
15
     // started, and picking the correct half of the word with i%2
16
     program_word_ptr = ram_ptr * 16 + (i/2) ; // Start on word0 or word1
17
     tmp_program_word = program_array[program_word_ptr];
18
     ddr2_ram_mem_line[15:0] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
19
 
20
     program_word_ptr = program_word_ptr + 2;
21
     tmp_program_word = program_array[program_word_ptr];
22
     ddr2_ram_mem_line[31:16] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
23
 
24
     program_word_ptr = program_word_ptr + 2;
25
     tmp_program_word = program_array[program_word_ptr];
26
     ddr2_ram_mem_line[47:32] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
27
 
28
     program_word_ptr = program_word_ptr + 2;
29
     tmp_program_word = program_array[program_word_ptr];
30
     ddr2_ram_mem_line[63:48] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
31
 
32
     program_word_ptr = program_word_ptr + 2;
33
     tmp_program_word = program_array[program_word_ptr];
34
     ddr2_ram_mem_line[79:64] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
35
 
36
     program_word_ptr = program_word_ptr + 2;
37
     tmp_program_word = program_array[program_word_ptr];
38
     ddr2_ram_mem_line[95:80] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
39
 
40
     program_word_ptr = program_word_ptr + 2;
41
     tmp_program_word = program_array[program_word_ptr];
42
     ddr2_ram_mem_line[111:96] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
43
 
44
     program_word_ptr = program_word_ptr + 2;
45
     tmp_program_word = program_array[program_word_ptr];
46
     ddr2_ram_mem_line[127:112] = tmp_program_word[15 + ((i%2)*16):((i%2)*16)];
47
 
48
     // Put this assembled line into the RAM using its memory writing TASK
49
     u_mem0.memory_write(2'b00,ram_ptr[19:7],
50
                         {ram_ptr[6:0],3'b000},ddr2_ram_mem_line);
51
 
52
     //$display("Writing 0x%h, ramline=%d",ddr2_ram_mem_line, ram_ptr);
53
 
54
  end // for (ram_ptr = 0 ; ram_ptr < ...
55
$display("(%t) * DDR2 RAM %1d preloaded",$time, i);
56 415 julius
 

powered by: WebSVN 2.1.0

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