Quantcast
Channel: Altera Forums
Viewing all articles
Browse latest Browse all 19390

Display Mif / Hex file in dual port ram on Nios II stdout

$
0
0
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;
}

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.

Viewing all articles
Browse latest Browse all 19390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>