提交 5f3252a2 编写于 作者: 饶先宏's avatar 饶先宏

202109032123 增加了软件中的w, r读写命令

上级 187d2bd8
......@@ -513,14 +513,24 @@ inout [35:0] GPIO;
led5 <= 8'h6d;
end
else if (wWrite && ((bWriteAddr & 32'hffffff00) == 32'hf0000000)) begin
if (bWriteAddr[7:0] == 8'h10) begin
led0 <= bWriteData[6:0];
led1 <= bWriteData[14:8];
led2 <= bWriteData[22:16];
led3 <= bWriteData[30:24];
end else if (bWriteAddr[7:0] == 8'h14) begin
led4 <= bWriteData[6:0];
led5 <= bWriteData[14:8];
if (bWriteAddr[3:2] == 2'h0) begin
if (bWriteMask[0] == 0)
led0 <= bWriteData[6:0];
if (bWriteMask[1] == 0)
led1 <= bWriteData[14:8];
if (bWriteMask[2] == 0)
led2 <= bWriteData[22:16];
if (bWriteMask[3] == 0)
led3 <= bWriteData[30:24];
end else if (bWriteAddr[3:2] == 2'h1) begin
if (bWriteMask[0] == 0)
led4 <= bWriteData[6:0];
if (bWriteMask[1] == 0)
led5 <= bWriteData[14:8];
if (bWriteMask[2] == 0)
led6 <= bWriteData[22:16];
if (bWriteMask[3] == 0)
led7 <= bWriteData[30:24];
end
end
end
......
......@@ -2,8 +2,8 @@
#define UARTADDRESS (unsigned int *)0xf0000100
#define REFFREQ 50000000
volatile unsigned int* _uartaddr = UARTADDRESS;
volatile unsigned int _uartstate;
static volatile unsigned int* _uartaddr = UARTADDRESS;
static volatile unsigned int _uartstate;
/*
地址 0 -- 读接收数据
......@@ -15,19 +15,19 @@ volatile unsigned int _uartstate;
[26:17] -- recv buffer used
*/
int _canputchar()
static int _canputchar()
{
_uartstate = _uartaddr[2];
return ((_uartstate & 1) == 0);
}
int _haschar()
static int _haschar()
{
_uartstate = _uartaddr[2];
return ((_uartstate & 0x10000) == 0);
}
int _putchar(int ch)
static int _putchar(int ch)
{
_uartstate = _uartaddr[2];
if ((_uartstate & 1) == 0) {
......@@ -37,7 +37,7 @@ int _putchar(int ch)
return -1;
}
int _getchar()
static int _getchar()
{
_uartstate = _uartaddr[2];
if ((_uartstate & 0x10000) == 0) {
......@@ -46,7 +46,7 @@ int _getchar()
return -1;
}
int _puts(const char* s)
static int _puts(const char* s)
{
while (*s) {
while (_putchar(*s) == -1)
......@@ -56,7 +56,7 @@ int _puts(const char* s)
return 0;
}
int _gets(char* s, int buflen)
static int _gets(char* s, int buflen)
{
int ind, ch;
ind = 0;
......@@ -65,7 +65,13 @@ int _gets(char* s, int buflen)
do {
ch = _getchar();
if (ch != -1) {
s[ind++] = ch;
if (ch == '\b') {
if (ind > 0)
ind--;
}
else {
s[ind++] = ch;
}
while(_putchar(ch) == -1) /* 回显 */
;
if (ind >= buflen - 1)
......@@ -78,7 +84,7 @@ int _gets(char* s, int buflen)
return ind;
}
int _d2s(char* buf, int num)
static int _d2s(char* buf, int num)
{
int i;
int len;
......@@ -106,7 +112,7 @@ int _d2s(char* buf, int num)
return len;
}
int _h2s(char* buf, unsigned long long num, int fixlen, char lead)
static int _h2s(char* buf, unsigned long long num, int fixlen, char lead)
{
int i;
int len;
......@@ -134,7 +140,7 @@ int _h2s(char* buf, unsigned long long num, int fixlen, char lead)
return len;
}
int _s2d(const char* buf, const char** next)
static int _s2d(char* buf, char** next)
{
int state;
int ret;
......@@ -169,7 +175,7 @@ int _s2d(const char* buf, const char** next)
return ret;
}
int _s2h(const char* buf, const char** next)
static int _s2h(char* buf, char** next)
{
int state;
int ret;
......@@ -204,7 +210,7 @@ int _s2h(const char* buf, const char** next)
return ret;
}
int _strlen(const char* s)
static int _strlen(const char* s)
{
const char* ss;
ss = s;
......@@ -212,7 +218,7 @@ int _strlen(const char* s)
return s - ss;
}
int _strcpy(char* s, const char* t)
static int _strcpy(char* s, const char* t)
{
char* ss = s;
while (*t)
......@@ -221,7 +227,7 @@ int _strcpy(char* s, const char* t)
return s - ss;
}
int _strcat(char* s, const char* t)
static int _strcat(char* s, const char* t)
{
char* ss = s;
while (*s)
......@@ -232,7 +238,7 @@ int _strcat(char* s, const char* t)
return s - ss;
}
int _strcmp(const char* s, const char* t)
static int _strcmp(const char* s, const char* t)
{
while (*s && *t) {
if (*s++ != *t++)
......@@ -241,7 +247,7 @@ int _strcmp(const char* s, const char* t)
return 0;
}
int _strncmp(const char* s, const char* t, int n)
static int _strncmp(const char* s, const char* t, int n)
{
int count;
count = 0;
......@@ -255,31 +261,31 @@ int _strncmp(const char* s, const char* t, int n)
return 0;
}
int _buadrateset(int baud)
static int _buadrateset(int baud)
{
_uartaddr[4] = REFFREQ / baud;
return 0;
}
unsigned int displayaddr = 0;
void dispmem()
static unsigned int displayaddr = 0;
static void dispmem()
{
int i, j, len;
unsigned int startaddr = displayaddr & 0xfffffff0;
char buf[256];
for (j = 0; j < 16; j++) {
_h2s(buf, startaddr, 8, '0');
len = _strcat(buf, " ");
_strcat(buf, " ");
for (i = 0; i < 16; i++) {
unsigned char* disp = (unsigned char*)startaddr;
if (startaddr + i < displayaddr) {
len = _strcat(buf, " ");
_strcat(buf, " ");
}
else {
char temp[8];
_h2s(temp, disp[i], 2, '0');
_strcat(temp, " ");
len = _strcat(buf, temp);
_strcat(buf, temp);
}
if (i == 7)
_strcat(buf, "- ");
......@@ -321,12 +327,12 @@ const unsigned int segcode[10] =
0x6f,// 8'b01101111,
};
unsigned int num2seg(unsigned int num)
static unsigned int num2seg(unsigned int num)
{
return segcode[num % 10];
}
unsigned long long cycle() {
static unsigned long long cycle() {
unsigned long long ret;
unsigned int retl, reth;
asm volatile (
......@@ -341,7 +347,7 @@ unsigned long long cycle() {
return ret;
}
unsigned long long instrcount() {
static unsigned long long instrcount() {
unsigned long long ret;
unsigned int retl, reth;
asm volatile (
......@@ -356,6 +362,14 @@ unsigned long long instrcount() {
return ret;
}
static void printhelp()
{
_puts(" d <addr> -- display memory \n");
_puts(" b <baudrate> -- set baudrate \n");
_puts(" r <addr> <width> \n");
_puts(" w <addr> <value> <width> \n");
_puts(" width=1,2 or 4\n");
}
int main(int argc, char* argv[])
{
......@@ -416,11 +430,11 @@ int main(int argc, char* argv[])
ledd[11] = num2seg(ctemp / 1000);
leddata[0] = *(unsigned int*)&ledd[0];
leddata[1] = *(unsigned int*)&ledd[4];
leddata[2] = *(unsigned int*)&ledd[8];
//leddata[1] = *(unsigned int*)&ledd[4];
//leddata[2] = *(unsigned int*)&ledd[8];
}
else {
unsigned int count = cycle()/1000;
unsigned int count = cycle()>>10;
ledd[0] = num2seg(count);
ledd[1] = num2seg(count1 / 10);
......@@ -431,23 +445,76 @@ int main(int argc, char* argv[])
} while (1);
_puts(":");
_puts(buf);
_puts("\n\r");
if (_strncmp(buf, "help ", 4) == 0) {
_puts(" d <addr> -- display memory \n");
_puts(" b <baudrate> -- set baudrate \n");
printhelp();
}
else if (_strncmp(buf, "b", 1) == 0) {
else if (buf[0] == 'b') {
int baud = _s2d(buf+2, 0);
if (baud > 0) {
_buadrateset(baud);
}
else {
printhelp();
}
}
else if (_strncmp(buf, "d", 1) == 0) {
else if (buf[0] == 'd') {
int addr = _s2h(buf + 2, 0);
if (addr > 0) {
displayaddr = addr;
}
dispmem();
}
else if (buf[0] == 'w') {
char* next;
int addr = _s2h(buf + 2, &next);
int value = _s2h(next, &next);
int width = _s2h(next, &next);
if (width == 1) {
*(char*)addr = value;
}
else if (width == 2) {
*(short*)addr = value;
}
else if (width == 4) {
*(int*)addr = value;
}
else {
printhelp();
}
}
else if (buf[0] == 'r') {
char* next;
int value = 0;
int addr = _s2h(buf + 2, &next);
int width = _s2h(next, &next);
if (width == 1) {
value = *(char*)addr;
_puts("char @");
}
else if (width == 2) {
value = *(short*)addr;
_puts("short @");
}
else if (width == 4) {
value = *(int*)addr;
_puts("int @");
}
else {
printhelp();
}
if (width == 1 || width == 2 || width == 4) {
_h2s(buf, addr, 8, '0');
_puts(buf);
_puts(" = ");
_d2s(buf, value);
_puts(buf);
_puts("(");
_h2s(buf, value, width * 2, '0');
_puts(buf);
_puts(")\n\r");
}
}
} while (1);
return 1;
}
#!/bin/bash
riscv32-unknown-elf-gcc -Wl,-Ttest.ld console.c -o test.elf
riscv32-unknown-elf-gcc -ffunction-sections -fdata-sections -Wl,-Ttest.ld -Wl,--gc-sections console.c -o test.elf
riscv32-unknown-elf-objcopy test.elf -O ihex test.hex
riscv32-unknown-elf-objcopy test.elf -O verilog test.cod
riscv32-unknown-elf-objdump -D -M no-aliases,numeric test.elf > test.txt
......
......@@ -10,7 +10,7 @@ ELF Header:
Version: 0x1
Entry point address: 0x8c
Start of program headers: 52 (bytes into file)
Start of section headers: 20444 (bytes into file)
Start of section headers: 20440 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
......@@ -22,28 +22,28 @@ ELF Header:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000074 000074 001c58 00 AX 0 0 4
[ 2] .rodata PROGBITS 00001ccc 001ccc 0001bc 00 A 0 0 4
[ 3] .eh_frame PROGBITS 00002000 002000 00002c 00 WA 0 0 4
[ 4] .init_array INIT_ARRAY 0000202c 00202c 000008 04 WA 0 0 4
[ 5] .fini_array FINI_ARRAY 00002034 002034 000004 04 WA 0 0 4
[ 6] .data PROGBITS 00002038 002038 000428 00 WA 0 0 8
[ 7] .sdata PROGBITS 00002460 002460 000010 00 WA 0 0 4
[ 8] .sbss NOBITS 00002470 002470 000008 00 WA 0 0 4
[ 9] .bss NOBITS 00002478 002470 00001c 00 WA 0 0 4
[10] .comment PROGBITS 00000000 002470 000012 01 MS 0 0 1
[11] .riscv.attributes RISCV_ATTRIBUTE 00000000 002482 00002a 00 0 0 1
[12] .debug_aranges PROGBITS 00000000 0024ac 000038 00 0 0 1
[13] .debug_info PROGBITS 00000000 0024e4 000839 00 0 0 1
[14] .debug_abbrev PROGBITS 00000000 002d1d 000216 00 0 0 1
[15] .debug_line PROGBITS 00000000 002f33 000766 00 0 0 1
[16] .debug_str PROGBITS 00000000 003699 00029a 01 MS 0 0 1
[17] .debug_line_str PROGBITS 00000000 003933 0000aa 01 MS 0 0 1
[18] .debug_loclists PROGBITS 00000000 0039dd 000a99 00 0 0 1
[19] .debug_rnglists PROGBITS 00000000 004476 000111 00 0 0 1
[20] .symtab SYMTAB 00000000 004588 000620 10 21 51 4
[21] .strtab STRTAB 00000000 004ba8 000344 00 0 0 1
[22] .shstrtab STRTAB 00000000 004eec 0000ee 00 0 0 1
[ 1] .text PROGBITS 00000074 000074 001db0 00 AX 0 0 4
[ 2] .rodata PROGBITS 00001e24 001e24 000228 00 A 0 0 4
[ 3] .eh_frame PROGBITS 0000304c 00204c 00002c 00 WA 0 0 4
[ 4] .init_array INIT_ARRAY 00003078 002078 000008 04 WA 0 0 4
[ 5] .fini_array FINI_ARRAY 00003080 002080 000004 04 WA 0 0 4
[ 6] .data PROGBITS 00003088 002088 000428 00 WA 0 0 8
[ 7] .sdata PROGBITS 000034b0 0024b0 00000c 00 WA 0 0 4
[ 8] .sbss NOBITS 000034bc 0024bc 000008 00 WA 0 0 4
[ 9] .bss NOBITS 000034c4 0024bc 00001c 00 WA 0 0 4
[10] .comment PROGBITS 00000000 0024bc 000012 01 MS 0 0 1
[11] .riscv.attributes RISCV_ATTRIBUTE 00000000 0024ce 000025 00 0 0 1
[12] .debug_aranges PROGBITS 00000000 0024f3 000038 00 0 0 1
[13] .debug_info PROGBITS 00000000 00252b 000839 00 0 0 1
[14] .debug_abbrev PROGBITS 00000000 002d64 000216 00 0 0 1
[15] .debug_line PROGBITS 00000000 002f7a 000766 00 0 0 1
[16] .debug_str PROGBITS 00000000 0036e0 000296 01 MS 0 0 1
[17] .debug_line_str PROGBITS 00000000 003976 0000b0 01 MS 0 0 1
[18] .debug_loclists PROGBITS 00000000 003a26 000a99 00 0 0 1
[19] .debug_rnglists PROGBITS 00000000 0044bf 000111 00 0 0 1
[20] .symtab SYMTAB 00000000 0045d0 0005f0 10 21 72 4
[21] .strtab STRTAB 00000000 004bc0 000329 00 0 0 1
[22] .shstrtab STRTAB 00000000 004ee9 0000ee 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
......@@ -54,8 +54,8 @@ There are no section groups in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x00000000 0x00000000 0x01e88 0x01e88 R E 0x1000
LOAD 0x002000 0x00002000 0x00002000 0x00470 0x00494 RW 0x1000
LOAD 0x000000 0x00000000 0x00000000 0x0204c 0x0204c R E 0x1000
LOAD 0x00204c 0x0000304c 0x0000304c 0x00470 0x00494 RW 0x1000
Section to Segment mapping:
Segment Sections...
......@@ -68,18 +68,18 @@ There are no relocations in this file.
The decoding of unwind sections for machine type RISC-V is not currently supported.
Symbol table '.symtab' contains 98 entries:
Symbol table '.symtab' contains 95 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000074 0 SECTION LOCAL DEFAULT 1 .text
2: 00001ccc 0 SECTION LOCAL DEFAULT 2 .rodata
3: 00002000 0 SECTION LOCAL DEFAULT 3 .eh_frame
4: 0000202c 0 SECTION LOCAL DEFAULT 4 .init_array
5: 00002034 0 SECTION LOCAL DEFAULT 5 .fini_array
6: 00002038 0 SECTION LOCAL DEFAULT 6 .data
7: 00002460 0 SECTION LOCAL DEFAULT 7 .sdata
8: 00002470 0 SECTION LOCAL DEFAULT 8 .sbss
9: 00002478 0 SECTION LOCAL DEFAULT 9 .bss
2: 00001e24 0 SECTION LOCAL DEFAULT 2 .rodata
3: 0000304c 0 SECTION LOCAL DEFAULT 3 .eh_frame
4: 00003078 0 SECTION LOCAL DEFAULT 4 .init_array
5: 00003080 0 SECTION LOCAL DEFAULT 5 .fini_array
6: 00003088 0 SECTION LOCAL DEFAULT 6 .data
7: 000034b0 0 SECTION LOCAL DEFAULT 7 .sdata
8: 000034bc 0 SECTION LOCAL DEFAULT 8 .sbss
9: 000034c4 0 SECTION LOCAL DEFAULT 9 .bss
10: 00000000 0 SECTION LOCAL DEFAULT 10 .comment
11: 00000000 0 SECTION LOCAL DEFAULT 11 .riscv.attributes
12: 00000000 0 SECTION LOCAL DEFAULT 12 .debug_aranges
......@@ -93,86 +93,83 @@ Symbol table '.symtab' contains 98 entries:
20: 00000000 0 FILE LOCAL DEFAULT ABS __call_atexit.c
21: 00000074 24 FUNC LOCAL DEFAULT 1 register_fini
22: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
23: 00002000 0 OBJECT LOCAL DEFAULT 3 __EH_FRAME_BEGIN__
23: 0000304c 0 OBJECT LOCAL DEFAULT 3 __EH_FRAME_BEGIN__
24: 000000d8 0 FUNC LOCAL DEFAULT 1 __do_global_dtors_aux
25: 00002478 1 OBJECT LOCAL DEFAULT 9 completed.1
26: 00002034 0 OBJECT LOCAL DEFAULT 5 __do_global_dtor[...]
25: 000034c4 1 OBJECT LOCAL DEFAULT 9 completed.1
26: 00003080 0 OBJECT LOCAL DEFAULT 5 __do_global_dtor[...]
27: 0000011c 0 FUNC LOCAL DEFAULT 1 frame_dummy
28: 0000247c 24 OBJECT LOCAL DEFAULT 9 object.0
29: 00002030 0 OBJECT LOCAL DEFAULT 4 __frame_dummy_in[...]
28: 000034c8 24 OBJECT LOCAL DEFAULT 9 object.0
29: 0000307c 0 OBJECT LOCAL DEFAULT 4 __frame_dummy_in[...]
30: 00000000 0 FILE LOCAL DEFAULT ABS console.c
31: 00000000 0 FILE LOCAL DEFAULT ABS libgcc2.c
32: 00000000 0 FILE LOCAL DEFAULT ABS libgcc2.c
33: 00000000 0 FILE LOCAL DEFAULT ABS exit.c
34: 00000000 0 FILE LOCAL DEFAULT ABS impure.c
35: 00002038 1064 OBJECT LOCAL DEFAULT 6 impure_data
36: 00000000 0 FILE LOCAL DEFAULT ABS init.c
37: 00000000 0 FILE LOCAL DEFAULT ABS fini.c
38: 00000000 0 FILE LOCAL DEFAULT ABS atexit.c
39: 00000000 0 FILE LOCAL DEFAULT ABS __atexit.c
40: 00000000 0 FILE LOCAL DEFAULT ABS sys_exit.c
41: 00000000 0 FILE LOCAL DEFAULT ABS errno.c
42: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
43: 00002028 0 OBJECT LOCAL DEFAULT 3 __FRAME_END__
44: 00000000 0 FILE LOCAL DEFAULT ABS
45: 00002038 0 NOTYPE LOCAL DEFAULT 5 __fini_array_end
46: 00002034 0 NOTYPE LOCAL DEFAULT 5 __fini_array_start
47: 00002034 0 NOTYPE LOCAL DEFAULT 4 __init_array_end
48: 0000202c 0 NOTYPE LOCAL DEFAULT 4 __preinit_array_end
49: 0000202c 0 NOTYPE LOCAL DEFAULT 4 __init_array_start
50: 0000202c 0 NOTYPE LOCAL DEFAULT 4 __preinit_array_start
51: 000001b8 88 FUNC GLOBAL DEFAULT 1 _putchar
52: 00000e28 124 FUNC GLOBAL DEFAULT 1 cycle
53: 00000994 140 FUNC GLOBAL DEFAULT 1 _strcat
54: 00002838 0 NOTYPE GLOBAL DEFAULT ABS __global_pointer$
55: 00000a20 112 FUNC GLOBAL DEFAULT 1 _strcmp
56: 00001ce8 40 OBJECT GLOBAL DEFAULT 2 segcode
57: 00001cc4 8 FUNC GLOBAL DEFAULT 1 __errno
58: 00002460 0 NOTYPE GLOBAL DEFAULT 7 __SDATA_BEGIN__
59: 0000013c 60 FUNC GLOBAL DEFAULT 1 _canputchar
60: 0000079c 312 FUNC GLOBAL DEFAULT 1 _s2h
61: 0000025c 104 FUNC GLOBAL DEFAULT 1 _puts
62: 00000b28 64 FUNC GLOBAL DEFAULT 1 _buadrateset
63: 000004f8 424 FUNC GLOBAL DEFAULT 1 _h2s
64: 00002464 0 OBJECT GLOBAL HIDDEN 7 __dso_handle
65: 00000b68 640 FUNC GLOBAL DEFAULT 1 dispmem
66: 00000178 64 FUNC GLOBAL DEFAULT 1 _haschar
67: 00002460 4 OBJECT GLOBAL DEFAULT 7 _global_impure_ptr
68: 000018f4 156 FUNC GLOBAL DEFAULT 1 __libc_init_array
69: 00001494 1072 FUNC GLOBAL HIDDEN 1 __udivdi3
70: 000002c4 216 FUNC GLOBAL DEFAULT 1 _gets
71: 00001b8c 92 FUNC GLOBAL DEFAULT 1 __libc_fini_array
72: 000006a0 252 FUNC GLOBAL DEFAULT 1 _s2d
73: 00001a6c 288 FUNC GLOBAL DEFAULT 1 __call_exitprocs
74: 0000008c 76 FUNC GLOBAL DEFAULT 1 _start
75: 00001bfc 152 FUNC GLOBAL DEFAULT 1 __register_exitproc
76: 00000210 76 FUNC GLOBAL DEFAULT 1 _getchar
77: 00002494 0 NOTYPE GLOBAL DEFAULT 9 __BSS_END__
78: 00002468 4 OBJECT GLOBAL DEFAULT 7 _uartaddr
79: 0000039c 348 FUNC GLOBAL DEFAULT 1 _d2s
80: 00002470 0 NOTYPE GLOBAL DEFAULT 8 __bss_start
81: 00001990 220 FUNC GLOBAL DEFAULT 1 memset
82: 00000f20 1396 FUNC GLOBAL DEFAULT 1 main
83: 00002474 4 OBJECT GLOBAL DEFAULT 8 displayaddr
84: 00000924 112 FUNC GLOBAL DEFAULT 1 _strcpy
85: 00001d88 256 OBJECT GLOBAL HIDDEN 2 __clz_tab
86: 00001be8 20 FUNC GLOBAL DEFAULT 1 atexit
87: 0000246c 4 OBJECT GLOBAL DEFAULT 7 _impure_ptr
88: 00002038 0 NOTYPE GLOBAL DEFAULT 6 __DATA_BEGIN__
89: 00000a90 152 FUNC GLOBAL DEFAULT 1 _strncmp
90: 00000de8 64 FUNC GLOBAL DEFAULT 1 num2seg
91: 00002470 4 OBJECT GLOBAL DEFAULT 8 _uartstate
92: 00002470 0 NOTYPE GLOBAL DEFAULT 7 _edata
93: 00002494 0 NOTYPE GLOBAL DEFAULT 9 _end
94: 000018c4 48 FUNC GLOBAL DEFAULT 1 exit
95: 000008d4 80 FUNC GLOBAL DEFAULT 1 _strlen
96: 00001c94 48 FUNC GLOBAL DEFAULT 1 _exit
97: 00000ea4 124 FUNC GLOBAL DEFAULT 1 instrcount
31: 000034b4 4 OBJECT LOCAL DEFAULT 7 _uartaddr
32: 000034bc 4 OBJECT LOCAL DEFAULT 8 _uartstate
33: 0000013c 60 FUNC LOCAL DEFAULT 1 _canputchar
34: 00000178 64 FUNC LOCAL DEFAULT 1 _haschar
35: 000001b8 88 FUNC LOCAL DEFAULT 1 _putchar
36: 00000210 76 FUNC LOCAL DEFAULT 1 _getchar
37: 0000025c 104 FUNC LOCAL DEFAULT 1 _puts
38: 000002c4 252 FUNC LOCAL DEFAULT 1 _gets
39: 000003c0 348 FUNC LOCAL DEFAULT 1 _d2s
40: 0000051c 424 FUNC LOCAL DEFAULT 1 _h2s
41: 000006c4 252 FUNC LOCAL DEFAULT 1 _s2d
42: 000007c0 312 FUNC LOCAL DEFAULT 1 _s2h
43: 000008f8 140 FUNC LOCAL DEFAULT 1 _strcat
44: 00000984 152 FUNC LOCAL DEFAULT 1 _strncmp
45: 00000a1c 64 FUNC LOCAL DEFAULT 1 _buadrateset
46: 000034c0 4 OBJECT LOCAL DEFAULT 8 displayaddr
47: 00000a5c 628 FUNC LOCAL DEFAULT 1 dispmem
48: 00000cd0 64 FUNC LOCAL DEFAULT 1 num2seg
49: 00000d10 124 FUNC LOCAL DEFAULT 1 cycle
50: 00000d8c 124 FUNC LOCAL DEFAULT 1 instrcount
51: 00000e08 96 FUNC LOCAL DEFAULT 1 printhelp
52: 00000000 0 FILE LOCAL DEFAULT ABS libgcc2.c
53: 00000000 0 FILE LOCAL DEFAULT ABS exit.c
54: 00000000 0 FILE LOCAL DEFAULT ABS init.c
55: 00000000 0 FILE LOCAL DEFAULT ABS fini.c
56: 00000000 0 FILE LOCAL DEFAULT ABS atexit.c
57: 00000000 0 FILE LOCAL DEFAULT ABS __atexit.c
58: 00000000 0 FILE LOCAL DEFAULT ABS sys_exit.c
59: 00000000 0 FILE LOCAL DEFAULT ABS errno.c
60: 00000000 0 FILE LOCAL DEFAULT ABS libgcc2.c
61: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
62: 00003074 0 OBJECT LOCAL DEFAULT 3 __FRAME_END__
63: 00000000 0 FILE LOCAL DEFAULT ABS impure.c
64: 00003088 1064 OBJECT LOCAL DEFAULT 6 impure_data
65: 00000000 0 FILE LOCAL DEFAULT ABS
66: 00003084 0 NOTYPE LOCAL DEFAULT 5 __fini_array_end
67: 00003080 0 NOTYPE LOCAL DEFAULT 5 __fini_array_start
68: 00003080 0 NOTYPE LOCAL DEFAULT 4 __init_array_end
69: 00003078 0 NOTYPE LOCAL DEFAULT 4 __preinit_array_end
70: 00003078 0 NOTYPE LOCAL DEFAULT 4 __init_array_start
71: 00003078 0 NOTYPE LOCAL DEFAULT 4 __preinit_array_start
72: 00003888 0 NOTYPE GLOBAL DEFAULT ABS __global_pointer$
73: 00001f24 40 OBJECT GLOBAL DEFAULT 2 segcode
74: 00001e1c 8 FUNC GLOBAL DEFAULT 1 __errno
75: 000034b0 0 NOTYPE GLOBAL DEFAULT 7 __SDATA_BEGIN__
76: 000034b0 4 OBJECT GLOBAL DEFAULT 7 _global_impure_ptr
77: 00001a4c 156 FUNC GLOBAL DEFAULT 1 __libc_init_array
78: 000015ec 1072 FUNC GLOBAL HIDDEN 1 __udivdi3
79: 00001ce4 92 FUNC GLOBAL DEFAULT 1 __libc_fini_array
80: 00001bc4 288 FUNC GLOBAL DEFAULT 1 __call_exitprocs
81: 0000008c 76 FUNC GLOBAL DEFAULT 1 _start
82: 00001d54 152 FUNC GLOBAL DEFAULT 1 __register_exitproc
83: 000034e0 0 NOTYPE GLOBAL DEFAULT 9 __BSS_END__
84: 000034bc 0 NOTYPE GLOBAL DEFAULT 8 __bss_start
85: 00001ae8 220 FUNC GLOBAL DEFAULT 1 memset
86: 00000e68 1924 FUNC GLOBAL DEFAULT 1 main
87: 00001f4c 256 OBJECT GLOBAL HIDDEN 2 __clz_tab
88: 00001d40 20 FUNC GLOBAL DEFAULT 1 atexit
89: 000034b8 4 OBJECT GLOBAL DEFAULT 7 _impure_ptr
90: 00003088 0 NOTYPE GLOBAL DEFAULT 6 __DATA_BEGIN__
91: 000034bc 0 NOTYPE GLOBAL DEFAULT 7 _edata
92: 000034e0 0 NOTYPE GLOBAL DEFAULT 9 _end
93: 00001a1c 48 FUNC GLOBAL DEFAULT 1 exit
94: 00001dec 48 FUNC GLOBAL DEFAULT 1 _exit
No version information found in this file.
Attribute Section: riscv
File Attributes
Tag_RISCV_stack_align: 16-bytes
Tag_RISCV_arch: "rv32i2p0_m2p0_a2p0"
Tag_RISCV_arch: "rv32i2p0_m2p0"
Tag_RISCV_priv_spec: 1
Tag_RISCV_priv_spec_minor: 11
......@@ -227,7 +227,7 @@ module riscv_core(
write <= 0;
if (opcode == 5'h08) begin
writeaddr <= newwriteaddr;
writeaddr <= {newwriteaddr[31:2], 2'b00};
writemask <= 4'h0;
writedata <= rs2;
write <= 1'b1;
......@@ -296,7 +296,7 @@ module riscv_core(
end
end else if (state == `RISCVSTATE_WAIT_ST) begin
write <= 0;
writeaddr <= lastaddr + 4;
writeaddr <= {lastaddr[31:2], 2'b0} + 4;
if (opcode == 5'h08) begin
case (func3)
1:/*sh*/ begin
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册