OpenCores
no use no use 1/1 no use no use
RS232 output does not match simulation results
by rybackguo on Jun 16, 2012
rybackguo
Posts: 1
Joined: Apr 15, 2009
Last seen: Apr 8, 2014
Hi all,

I have downloaded the minsoc from opencores.

Then I write a C program to run on OpenRISC as below.

uart_init();
//Init core
REG8(TPM_BASE + TPM_MR) = SHA_START;

//tpm gets data
while (1){
//first encryption
//send 16 bytes, the 17th byte is the redundant newline character sent by the terminal
for(i = 0; i B = 0x33;
if(i REG8(TPM_BASE + TPM_DR) = B;
}

//wait for the operation to be ready
do{
status = REG8(TPM_BASE + TPM_SR);
}while((status & SHA_DONE) != (SHA_DONE));

//read back the value from core
for(i = 0; i A = REG8(TPM_BASE + TPM_DR);

//display values.
for(i = 0; i uart_putc(A);
}

The problem is that if I sent 16 bytes to the FPGA and read back the computed results, it will always give me a duplicate of the first byte and lost the last byte.
E.g., If what I expect is
2e3a7007e0696fed74cdf0e5d2e4651d,
then it will give me
2e2e3a7007e0696fed74cdf0e5d2e465.

In the last two for loops, if I iterate through the array 17 times, then the I will get this 2e2e3a7007e0696fed74cdf0e5d2e4651d. (you can see the last byte is coming out).

In simulation, I can see OpenRISC is reading the expected value 2e3a7007e0696fed74cdf0e5d2e4651d byte by byte back.

What could possibly be the reason for the redundant byte (2e) to be read back?

Thank you!


RE: RS232 output does not match simulation results
by rfajardo on Jun 17, 2012
rfajardo
Posts: 306
Joined: Jun 12, 2008
Last seen: Jan 6, 2020
Please, attach your C file instead. It seems that your code was mistakenly interpreted as formatation.

Regards,
Raul
no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.