- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to run nios sim to test a new LCD module. I have included a DMA as part of this system. I have defined an array an a pointer to that array as below: unsigned short lcd_frame_buffer[HORZ_PIX * VERT_PIX]; int main(void) . . . uncached_buffer = (unsigned short *)(alt_remap_uncached( (void *)(main_frame_buffer), (alt_u32)(HORZ_PIX * VERT_PIX))); My question is how and where do I initialize this data for a Modelsim simulaiton? I know that the array gets allocated memory in the .bss portion of the data code, but this is supposed to be zero initialization, right? I want to make a small perl script that initalizes the sram_comp_laneX.data files used by modelsim, intializing memory from the C code takes too long. But I am unsure where to initialize, the .bss portion or the stack? Any tips greatly appreciated. Thanks, -RayLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
***** Repeated from Software discussion: ***************
Hello all, I figured this out with a few tips from Altera. The declaration of the array and the decalred pointer create a buffer in the .bss portion of the code. So I just enabled a object dump file to correlate where my main buffer is located. I then wrote a small perl script to generate some bogus vectors that I would concatenate with the program .dat files. It seems to work okay. Just thought this post might save someone some time if they go with the Nios sim route: Here is the script: ***************************************** # Open Outfile# Create video memory for simualtion# Then paste to Prog .DAT file# <main_frame_buffer> = Hex 40e200/ 4 = 3880 ( Because we have 4 byte lanes) = Dec 14464# So Make $mem_depth = Hex 3880 + Hex 75300 = Hex 78B80 = Dec 494464# Dec 480_000 = Hex 75300 my $out_3_FH; open($out_3_FH, ">sram_prog_buff_1_lane3.dat") || die "Cannot open data:"; my $out_2_FH; open($out_2_FH, ">sram_prog_buff_1_lane2.dat") || die "Cannot open data:"; my $out_1_FH; open($out_1_FH, ">sram_prog_buff_1_lane1.dat") || die "Cannot open data:"; my $out_0_FH; open($out_0_FH, ">sram_prog_buff_1_lane0.dat") || die "Cannot open data:"; my $mem_depth = 494464; for($mem_addr = 14464; $mem_addr < $mem_depth; $mem_addr++) { my $out_pixel_at = "@"; my $pixel_data = " AA\n"; my $hex_mem_addr = sprintf("%08X",$mem_addr); my $mem_pixel = $out_pixel_at . $hex_mem_addr . $pixel_data; print{ $out_3_FH } $mem_pixel; } for($mem_addr = 14464; $mem_addr < $mem_depth; $mem_addr++) { my $out_pixel_at = "@"; my $pixel_data = " BB\n"; my $hex_mem_addr = sprintf("%08X",$mem_addr); my $mem_pixel = $out_pixel_at . $hex_mem_addr . $pixel_data; print{ $out_2_FH } $mem_pixel; } for($mem_addr = 14464; $mem_addr < $mem_depth; $mem_addr++) { my $out_pixel_at = "@"; my $pixel_data = " CC\n"; my $hex_mem_addr = sprintf("%08X",$mem_addr); my $mem_pixel = $out_pixel_at . $hex_mem_addr . $pixel_data; print{ $out_1_FH } $mem_pixel; } for($mem_addr = 14464; $mem_addr < $mem_depth; $mem_addr++) { my $out_pixel_at = "@"; my $pixel_data = " DD\n"; my $hex_mem_addr = sprintf("%08X",$mem_addr); my $mem_pixel = $out_pixel_at . $hex_mem_addr . $pixel_data; print{ $out_0_FH } $mem_pixel; } exit 0 **************************************** -Ray
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page