EmbDev.net

Forum: FPGA, VHDL & Verilog Microblaze - problem with reading from user logic input


Author: Tobi (Guest)
Posted on:

Rate this post
0 useful
not useful
Hi there

I am trying to link some custom made logic to my microblaze processor.

Apparently it is not working (who would have guessed so? :D ) and I 
wondered if the C code I am using is correct.

int *userlogicaddress;
userlogicaddress=(int *)XPAR_USERLOGICREADING_0_BASEADDR; 

dummy = *userlogicaddress; //reading from base address into dummy

XGpio gpPB; 
XGpio_Initialize(&gpPB, XPAR_LEDS_8BIT_DEVICE_ID);  //setting led output port
XGpio_SetDataDirection(&gpPB, 1, 0x00000000); // setting led port output direction
XGpio_DiscreteWrite(&gpPB, 1, dummy); // writing dummy from inputs to leds


The custom logic currently contains only one latch. "Q" side of the 
latches is connected to the databus the "D" side to pins which are 
connected to dip switches. "G" is linked to Bus2IP_RdCE

It is basically an inital try to read the state of the dip switches into 
the processor. (I know there are easier ways of doing this but it is 
just an inital start - the logic will become more complex later on).

As the custom logic only contains 1 32-bit data register I assume that 
the base address is the correct one to work with.

Is there any obviours error in accessing the register? If not I have to 
dig a bit deeper need to look in the VHDL files or the mdp file.

Cheers
 Tobi

Author: Martin R. (herki)
Posted on:

Rate this post
0 useful
not useful
Hi Tobi

Sorry for my bad english.

The instructrions are right. But u have to arrange it in another order.

First of all u have to init the XGpio showing in following code:

int *userlogicaddress;
XGpio gpPB;

XGpio_Initialize(&gpPB, XPAR_LEDS_8BIT_DEVICE_ID);  //setting led output 
port
XGpio_SetDataDirection(&gpPB, 1, 0x00000000); // setting led port output 
direction


userlogicaddress=(int *)XPAR_USERLOGICREADING_0_BASEADDR;

while (1)
{
   dummy = *userlogicaddress; //reading from base address into dummy
   XGpio_DiscreteWrite(&gpPB, 1, dummy); // writing dummy from inputs to 
leds
}

At the moment i can not test this code, cause i dont have any 
Microblaze-licence. Sorry.

Hope i could help u a little bit

Greetings

Martin

Author: Lewis (Guest)
Posted on:

Rate this post
0 useful
not useful
Hi there,

could someone please help, what I am trying to do is to read registers 
on the FPGA on the Spartan 3E starter kit with C implimented code on the 
Microblaze then perform some arithmatic and return the result back in 
another register on the FPGA.

I dont know where to start, and would be ever so greatful for some help,

Lewis

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.