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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [bus_explorer/] [main.c] - Diff between revs 68 and 69

Show entire file | Details | Blame | View Log

Rev 68 Rev 69
Line 174... Line 174...
    else if (tmp == 'x') {
    else if (tmp == 'x') {
      neorv32_uart0_printf("\n");
      neorv32_uart0_printf("\n");
      return;
      return;
    }
    }
    else {
    else {
      neorv32_uart0_printf("Invalid selection!\n");
      neorv32_uart0_printf("\nInvalid selection!\n");
    }
    }
  }
  }
}
}
 
 
 
 
Line 198... Line 198...
  neorv32_uart0_printf("Enter address (8 hex chars): 0x");
  neorv32_uart0_printf("Enter address (8 hex chars): 0x");
  neorv32_uart0_scan(terminal_buffer, 8+1, 1); // 8 hex chars for address plus '\0'
  neorv32_uart0_scan(terminal_buffer, 8+1, 1); // 8 hex chars for address plus '\0'
  register uint32_t mem_address = (uint32_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
  register uint32_t mem_address = (uint32_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
 
 
  // perform read access
  // perform read access
  neorv32_uart0_printf("\n[0x%x] = ", mem_address);
  neorv32_uart0_printf("\n[0x%x] => ", mem_address);
 
 
  neorv32_cpu_csr_write(CSR_MCAUSE, 0);
  neorv32_cpu_csr_write(CSR_MCAUSE, 0);
 
 
  uint8_t mem_data_b = 0;
  uint8_t mem_data_b = 0;
  uint16_t mem_data_h = 0;
  uint16_t mem_data_h = 0;
Line 256... Line 256...
  uint32_t mem_data_w = 0;
  uint32_t mem_data_w = 0;
  if (access_size == 'b') {
  if (access_size == 'b') {
    neorv32_uart0_printf("\nEnter data (2 hex chars): 0x");
    neorv32_uart0_printf("\nEnter data (2 hex chars): 0x");
    neorv32_uart0_scan(terminal_buffer, 2+1, 1); // 2 hex chars for address plus '\0'
    neorv32_uart0_scan(terminal_buffer, 2+1, 1); // 2 hex chars for address plus '\0'
    mem_data_b = (uint8_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
    mem_data_b = (uint8_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
 
    neorv32_uart0_printf("\n[0x%x] <= 0x", mem_address);
 
    aux_print_hex_byte(mem_data_b);
  }
  }
  if (access_size == 'h') {
  if (access_size == 'h') {
    neorv32_uart0_printf("\nEnter data (4 hex chars): 0x");
    neorv32_uart0_printf("\nEnter data (4 hex chars): 0x");
    neorv32_uart0_scan(terminal_buffer, 4+1, 1); // 4 hex chars for address plus '\0'
    neorv32_uart0_scan(terminal_buffer, 4+1, 1); // 4 hex chars for address plus '\0'
    mem_data_h = (uint16_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
    mem_data_h = (uint16_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
 
    neorv32_uart0_printf("\n[0x%x] <= 0x", mem_address);
 
    aux_print_hex_byte((uint8_t)(mem_data_h >> 8));
 
    aux_print_hex_byte((uint8_t)(mem_data_h >> 0));
  }
  }
  if (access_size == 'w') {
  if (access_size == 'w') {
    neorv32_uart0_printf("\nEnter data (8 hex chars): 0x");
    neorv32_uart0_printf("\nEnter data (8 hex chars): 0x");
    neorv32_uart0_scan(terminal_buffer, 8+1, 1); // 8 hex chars for address plus '\0'
    neorv32_uart0_scan(terminal_buffer, 8+1, 1); // 8 hex chars for address plus '\0'
    mem_data_w = (uint32_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
    mem_data_w = (uint32_t)hexstr_to_uint(terminal_buffer, strlen(terminal_buffer));
 
    neorv32_uart0_printf("\n[0x%x] <= 0x", mem_address);
 
    aux_print_hex_byte((uint8_t)(mem_data_w >> 24));
 
    aux_print_hex_byte((uint8_t)(mem_data_w >> 16));
 
    aux_print_hex_byte((uint8_t)(mem_data_w >> 8));
 
    aux_print_hex_byte((uint8_t)(mem_data_w >> 0));
  }
  }
 
 
  // perform write access
  // perform write access
  if (access_size == 'b') { neorv32_cpu_store_unsigned_byte(mem_address, mem_data_b); }
  if (access_size == 'b') { neorv32_cpu_store_unsigned_byte(mem_address, mem_data_b); }
  if (access_size == 'h') { neorv32_cpu_store_unsigned_half(mem_address, mem_data_h); }
  if (access_size == 'h') { neorv32_cpu_store_unsigned_half(mem_address, mem_data_h); }

powered by: WebSVN 2.1.0

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