Forums

verilog code for read write in Bram block

Started by rajiv July 7, 2007
Hi all,
       i am designing a system in which we have a bram
block,microblaze processor and other essential component.i have
written verilog code for bram controller .i have to call this verilog
code by a c programe.
C code is:

#include "stdio.h"
#include "xparameters.h"
#include "xuartlite_l.h"
#include "mb_interface.h"

int main(void)
{
int i,j,k;
int *mem;
int fill_value = 0x10000001;

//basic uart test
print ("hello world\r\n");
for (k=0;k<1;k++){

  //fill in values at consecutive addresses
mem= (int*)0x10000032;
for (i=0;i<50;i++)
	{
	*mem = i;
	xil_printf("%x\t%d\n\r",mem,*mem);
	mem++;
	}
//read back these values
mem = (int*)0x10000032;
for (i=0;i<55;i++)
	{
	print("ADDRESS=");
	xil_printf("%x",mem);
	print("\tfill_value=");
	xil_printf("%d",i);
	print("\tread=");
	xil_printf("%d",*mem);
	print("\r\n");

	mem++;
	}

print("\n\r done OK!");
}
print("\n\rdone!");
for (;;);
}

The address of the bram controller is from 10000000 to 10001fff but
this c code is not calling the verilog code written for the controller
so please suggest possible changes to achieve it.

On Jul 7, 9:36 am, rajiv <kahn...@gmail.com> wrote:
> int *mem;
....
> mem= (int*)0x10000032;
....
> The address of the bram controller is from 10000000 to 10001fff but > this c code is not calling the verilog code written for the controller > so please suggest possible changes to achieve it.
You could try declaring "mem" as volatile; volatile int *mem; mem= (volatile int*)0x10000032; Cheers, Andy