[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [partial-reconfig] Write/Read data on SRAM



Your values are being sign-extended, as if they are treated as signed
integers. Try changing "char" to "unsigned char" in the definition of
buf.


On 8/28/08, Paolo Furia <paolo.furia@xxxxxxxxx> wrote:
> Hi all,
> I'm trying to write data (a partial bitstream) on SRAM and then read them.
> I'm working on a ML402 (with a virtex-4 fpga) and I send the data through
> RS232. I've a Microblaze on my system that manage all.
> I use the following C code:
>
>
> /* BITSTREAM_BASEADDR is the base address of SRAM */
>
>      char buf, val;
>      int i;
>      Xuint32 baseaddr = BITSTREAM_BASEADDR;
>
>      for (i=0; i<50492; i++){
>
>         buf = XUartLite_RecvByte(UART_BASEADDR);
>
>         XIo_Out8((baseaddr+i), buf);
>
>         }
>
>
>         xil_printf("Bitstream stored!\n\r");
>
>
>         xil_printf("High address: %d\n\r", (baseaddr+i));
>
>
>         /***** Cycle to read the first 10 values stored *****/
>
>         xil_printf("value: %x\n\r\n\r", val);
>
>         xil_printf("\n Primi 10 valori salvati:\n\r\n");
>
>         for (i=0; i<10; i++){
>
>         val = XIo_In8((BITSTREAM_BASEADDR+i));
>
>         xil_printf("valore: %x\n\r\n\r", val);
>
>         }
>
>         /***** End of cycle *****/
>
>
>
> The first 10 values of the file I send are: FF FF FF FF 55 99 AA 66 04 00.
> But Microblaze reads from memory this: FFFFFFFF, FFFFFFFF, FFFFFFFF,
> FFFFFFFF, 55, FFFFFF99, FFFFFFAA, 66, 4, 0.
> I tried sending other values and I discovered that alla values between 0 and
> 127 are displayed well, while the values from 128 to 255 are dysplayed with
> FFFFFF ahead. Why? Do you have any suggestion? I'd very appreciate any help.
>
> Regards,
>
> Paolo Furia
>
___________________________
partial-reconfig mailing list
partial-reconfig@xxxxxxxxxxxxxx
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/partial-reconfig/