- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to fill a dual port ram (framebuffer) with a Mif File and then print it out with NIOS II and its C-Code programming.
The Mif File (converted to Hex) and loaded into the dual port ram looks like this:-- quartus prime generated memory initialization file (.mif)
width=8;
depth=12;
address_radix=hex;
data_radix=hex;
content begin
0 : ab;
1 : cd;
2 : ef;
3 : 12;
4 : 34;
5 : 56;
6 : 78;
7 : 9a;
8 : bc;
9 : de;
a : f1;
b : 23;
end;
The c-code for the NIOS II looks like this (and does not work): # include <stdio.h># include <stddef.h># include <stdint.h># include "system.h" int main(void) { int MEMORY_FB; MEMORY_FB = 0x5000; volatile char *mem_fb = (volatile char*) MEMORY_FB; int i; for (i=0;i<13;i++){ printf("%x\n", mem_fb); } return 0; } [/I]It prints out:
ffffffab
0
0
0
ffffffcd
0
0
0
ff
How can I fix this to get "ABCDEF123456789ABCDEF123" as an output?
This is only a test for image data a camera will collect later on.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if the RAM is connected as 8Bit addressable memory:
printf("%x", 0xff & mem_fb[i]); if the RAM is connected on a 32Bit bus teh upper bits may filled up with 0: printf("%x", 0xff & mem_fb[4*i]);- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
printf("%x", 0xff & mem_fb[i]); - worked!
Thanks!
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