Skip to content

Instantly share code, notes, and snippets.

@enjoy-digital
Created January 6, 2020 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjoy-digital/064e7f93d0eb783941db6848f6b41ea3 to your computer and use it in GitHub Desktop.
Save enjoy-digital/064e7f93d0eb783941db6848f6b41ea3 to your computer and use it in GitHub Desktop.
diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c
index 621d377a..1fb0be58 100644
--- a/litex/soc/software/bios/main.c
+++ b/litex/soc/software/bios/main.c
@@ -459,6 +459,12 @@ static void do_command(char *c)
#endif
else if(strcmp(token, "memtest") == 0) memtest();
#endif
+ else if(strcmp(token, "csr_test") == 0) {
+ printf("mr 0x82000004 32:\n");
+ mr("0x82000004", "16");
+ volatile unsigned int *scratch = (unsigned int *)0x82000004;
+ printf("scratch seen by CPU: 0x%08x\n", *scratch);
+ }
else if(strcmp(token, "") != 0)
printf("Command not found\n")
lxsim --cpu-type=vexriscv --csr-data-width=32
litex> csr_test
mr 0x82000004 32:
Memory dump:
0x82000004 78 56 34 12 00 00 00 00 00 00 00 00 00 00 00 00 xV4.............
scratch seen by CPU: 0x12345678
lxsim --cpu-type=lm32 --csr-data-width=32
litex> csr_test
mr 0x82000004 32:
Memory dump:
0x82000004 12 34 56 78 00 00 00 00 00 00 00 00 00 00 00 00 .4Vx............
scratch seen by CPU: 0x12345678
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment