2021-04-11 17:27:48 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "printf.h"
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
xilinx_uartlite_handle_t soc_uart;
|
|
|
|
xilinx_gpio_handle_t soc_gpio;
|
|
|
|
|
|
|
|
void _print_arch_string(uint64_t misa);
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
|
|
|
printf("Running on a Bluespec flute core.\r\n");
|
|
|
|
|
|
|
|
uint64_t csr = 0;
|
|
|
|
__csrr("misa", csr);
|
|
|
|
|
|
|
|
printf("MISA: 0x%016llx, this is a ", csr);
|
|
|
|
_print_arch_string(csr);
|
|
|
|
printf(" processor.\r\n");
|
|
|
|
|
|
|
|
printf("System clock frequency: %luHz\r\n", SYS_CLK_FREQ);
|
|
|
|
|
2021-04-11 17:37:44 +00:00
|
|
|
xilinx_gpio_pinmode(&soc_gpio, 0, 1);
|
|
|
|
|
2021-04-11 17:27:48 +00:00
|
|
|
for(;;) {
|
2021-04-11 17:37:44 +00:00
|
|
|
System_Delay(500);
|
2021-04-11 17:27:48 +00:00
|
|
|
__csrr("mcycle", csr);
|
|
|
|
printf("mcycle: 0x%016llx\r\n", csr);
|
2021-04-11 17:37:44 +00:00
|
|
|
xilinx_gpio_toggle(&soc_gpio, 0);
|
2021-04-11 17:27:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _print_arch_string(uint64_t misa) {
|
|
|
|
switch(misa >> 62) {
|
|
|
|
case 1:
|
|
|
|
printf("RV32");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
printf("RV64");
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
printf("RV128");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(uint8_t i = 0; i < 26; i++) {
|
|
|
|
if(misa >> i & 0x01ULL) {
|
|
|
|
printf("%c", 'A' + i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|