OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [demo_trng/] [main.c] - Diff between revs 51 and 60

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 51 Rev 60
Line 59... Line 59...
/**********************************************************************//**
/**********************************************************************//**
 * Simple true random number test/demo program.
 * Simple true random number test/demo program.
 *
 *
 * @note This program requires the UART and the TRNG to be synthesized.
 * @note This program requires the UART and the TRNG to be synthesized.
 *
 *
 * @return Irrelevant.
 * @return 0 if execution was successful
 **************************************************************************/
 **************************************************************************/
int main(void) {
int main(void) {
 
 
  // check if UART unit is implemented at all
  // check if UART unit is implemented at all
  if (neorv32_uart_available() == 0) {
  if (neorv32_uart_available() == 0) {
    return 0;
    return 1;
  }
  }
 
 
  // capture all exceptions and give debug info via UART
  // capture all exceptions and give debug info via UART
  // this is not required, but keeps us safe
  // this is not required, but keeps us safe
  neorv32_rte_setup();
  neorv32_rte_setup();
Line 85... Line 85...
  neorv32_uart_printf("\n--- TRNG Demo ---\n\n");
  neorv32_uart_printf("\n--- TRNG Demo ---\n\n");
 
 
  // check if TRNG unit is implemented at all
  // check if TRNG unit is implemented at all
  if (neorv32_trng_available() == 0) {
  if (neorv32_trng_available() == 0) {
    neorv32_uart_printf("No TRNG implemented.");
    neorv32_uart_printf("No TRNG implemented.");
    return 0;
    return 1;
  }
  }
 
 
  // enable TRNG
  // enable TRNG
  neorv32_trng_enable();
  neorv32_trng_enable();
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.