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

Subversion Repositories darkriscv

[/] [darkriscv/] [trunk/] [src/] [main.s] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 marcelos
        .file   "main.c"
2
        .option nopic
3
        .text
4
        .globl  __mulsi3
5
        .globl  __udivsi3
6
        .globl  __modsi3
7
        .globl  __divsi3
8
        .section        .text.startup,"ax",@progbits
9
        .align  2
10
        .globl  main
11
        .type   main, @function
12
main:
13
        addi    sp,sp,-120
14
        sw      s0,112(sp)
15
        lui     s0,%hi(io)
16
        lbu     a0,%lo(io)(s0)
17
        sw      ra,116(sp)
18
        sw      s1,108(sp)
19
        call    board_name
20
        lbu     a2,%lo(io)(s0)
21
        mv      a1,a0
22
        lui     a0,%hi(.LC3)
23
        addi    a0,a0,%lo(.LC3)
24
        call    printf
25
        lui     a1,%hi(.LC4)
26
        lui     a0,%hi(.LC5)
27
        addi    a1,a1,%lo(.LC4)
28
        addi    a0,a0,%lo(.LC5)
29
        call    printf
30
        addi    a5,s0,%lo(io)
31
        lui     s1,%hi(threads)
32
        lbu     t1,1(a5)
33
        lbu     t0,2(a5)
34
        lw      a4,%lo(threads)(s1)
35
        li      a5,1
36
        andi    t1,t1,0xff
37
        andi    t0,t0,0xff
38
        addi    s0,s0,%lo(io)
39
        bgt     a4,a5,.L29
40
        lui     a4,%hi(.LC1)
41
        addi    a4,a4,%lo(.LC1)
42
.L2:
43
        li      a2,16
44
        li      a1,16
45
        li      a0,1000
46
        sw      a4,8(sp)
47
        sw      t0,4(sp)
48
        sw      t1,0(sp)
49
        call    mac
50
        li      a5,1256
51
        lw      t1,0(sp)
52
        lw      t0,4(sp)
53
        lw      a4,8(sp)
54
        beq     a0,a5,.L30
55
        lui     a5,%hi(.LC1)
56
        addi    a5,a5,%lo(.LC1)
57
.L3:
58
        lui     a3,%hi(.LC6)
59
        lui     a0,%hi(.LC7)
60
        mv      a2,t0
61
        mv      a1,t1
62
        addi    a3,a3,%lo(.LC6)
63
        addi    a0,a0,%lo(.LC7)
64
        call    printf
65
        sw      zero,%lo(threads)(s1)
66
        lhu     a1,6(s0)
67
        lui     a0,%hi(.LC8)
68
        addi    a0,a0,%lo(.LC8)
69
        call    printf
70
        lbu     a0,1(s0)
71
        lbu     s1,2(s0)
72
        lw      a4,12(s0)
73
        lw      a2,12(s0)
74
        li      a1,999424
75
        addi    a1,a1,576
76
        sw      a2,4(sp)
77
        sw      a4,8(sp)
78
        call    __mulsi3
79
        andi    s1,s1,0xff
80
        li      a1,8192
81
        sw      a0,0(sp)
82
        addi    a1,a1,1808
83
        mv      a0,s1
84
        call    __mulsi3
85
        lw      a4,8(sp)
86
        lw      a5,0(sp)
87
        addi    a1,a4,1
88
        add     a0,a5,a0
89
        call    __udivsi3
90
        lw      a2,4(sp)
91
        mv      a1,a0
92
        lui     a0,%hi(.LC9)
93
        addi    a0,a0,%lo(.LC9)
94
        call    printf
95
        li      a0,10
96
        call    putchar
97
        lui     a0,%hi(.LC10)
98
        addi    a0,a0,%lo(.LC10)
99
        call    puts
100
        li      a0,10
101
        call    usleep
102
.L28:
103
        lui     a5,%hi(.LC11)
104
        addi    a0,a5,%lo(.LC11)
105
        call    printf
106
        li      a2,64
107
        li      a1,0
108
        addi    a0,sp,44
109
        call    memset
110
        li      a1,64
111
        addi    a0,sp,44
112
        call    gets
113
        li      s1,0
114
        addi    a0,sp,44
115
        lui     a4,%hi(.LC12)
116
.L4:
117
        addi    a1,a4,%lo(.LC12)
118
        call    strtok
119
        addi    a4,sp,108
120
        slli    a5,s1,2
121
        add     a5,a4,a5
122
        sw      a0,-96(a5)
123
        lui     a4,%hi(.LC12)
124
        beqz    a0,.L5
125
        addi    s1,s1,1
126
        li      a5,8
127
        li      a0,0
128
        bne     s1,a5,.L4
129
.L5:
130
        lw      s1,12(sp)
131
        beqz    s1,.L28
132
        lui     a1,%hi(.LC13)
133
        addi    a1,a1,%lo(.LC13)
134
        mv      a0,s1
135
        call    strcmp
136
        bnez    a0,.L9
137
        lui     a0,%hi(.LC14)
138
        addi    a0,a0,%lo(.LC14)
139
        call    printf
140
        j       .L28
141
.L29:
142
        lui     a4,%hi(.LC0)
143
        addi    a4,a4,%lo(.LC0)
144
        j       .L2
145
.L30:
146
        lui     a5,%hi(.LC2)
147
        addi    a5,a5,%lo(.LC2)
148
        j       .L3
149
.L9:
150
        lui     a1,%hi(.LC15)
151
        addi    a1,a1,%lo(.LC15)
152
        mv      a0,s1
153
        call    strcmp
154
        beqz    a0,.L50
155
        lui     a1,%hi(.LC18)
156
        addi    a1,a1,%lo(.LC18)
157
        mv      a0,s1
158
        call    strcmp
159
        bnez    a0,.L11
160
        lw      s1,16(sp)
161
        beqz    s1,.L12
162
        mv      a0,s1
163
        call    xtoi
164
        mv      s1,a0
165
.L12:
166
        addi    a5,s1,256
167
        sw      a5,0(sp)
168
.L16:
169
        lui     a5,%hi(.LC19)
170
        mv      a1,s1
171
        addi    a0,a5,%lo(.LC19)
172
        call    printf
173
        li      a4,0
174
        lui     a2,%hi(.LC20)
175
.L13:
176
        add     a3,s1,a4
177
        lbu     a1,0(a3)
178
        addi    a0,a2,%lo(.LC20)
179
        sw      a4,4(sp)
180
        call    printf
181
        lw      a4,4(sp)
182
        li      a3,16
183
        lui     a2,%hi(.LC20)
184
        addi    a4,a4,1
185
        bne     a4,a3,.L13
186
        li      a4,0
187
.L15:
188
        add     a3,s1,a4
189
        lbu     a0,0(a3)
190
        li      a2,94
191
        addi    a3,a0,-32
192
        andi    a3,a3,0xff
193
        bleu    a3,a2,.L14
194
        li      a0,46
195
.L14:
196
        sw      a4,4(sp)
197
        call    putchar
198
        lw      a4,4(sp)
199
        li      a3,16
200
        addi    a4,a4,1
201
        bne     a4,a3,.L15
202
        li      a0,10
203
        call    putchar
204
        lw      a5,0(sp)
205
        addi    s1,s1,16
206
        bne     s1,a5,.L16
207
        j       .L28
208
.L11:
209
        lui     a1,%hi(.LC21)
210
        addi    a1,a1,%lo(.LC21)
211
        mv      a0,s1
212
        call    strcmp
213
        bnez    a0,.L18
214
        lw      a0,16(sp)
215
        beqz    a0,.L19
216
        call    xtoi
217
        slli    a0,a0,16
218
        srli    a0,a0,16
219
        sh      a0,8(s0)
220
.L19:
221
        lhu     a1,8(s0)
222
        lui     a0,%hi(.LC22)
223
        addi    a0,a0,%lo(.LC22)
224
.L52:
225
        call    printf
226
        j       .L28
227
.L18:
228
        lui     a1,%hi(.LC23)
229
        addi    a1,a1,%lo(.LC23)
230
        mv      a0,s1
231
        call    strcmp
232
        bnez    a0,.L20
233
        lw      a0,16(sp)
234
        beqz    a0,.L21
235
        call    atoi
236
        sw      a0,12(s0)
237
.L21:
238
        lui     a0,%hi(.LC24)
239
        lw      a1,12(s0)
240
        addi    a0,a0,%lo(.LC24)
241
        j       .L52
242
.L20:
243
        lui     a1,%hi(.LC25)
244
        addi    a1,a1,%lo(.LC25)
245
        mv      a0,s1
246
        call    strcmp
247
        bnez    a0,.L22
248
        lw      a0,16(sp)
249
        beqz    a0,.L23
250
        call    xtoi
251
        slli    a0,a0,16
252
        srli    a0,a0,16
253
        sh      a0,10(s0)
254
.L23:
255
        lui     a0,%hi(.LC26)
256
        lhu     a1,10(s0)
257
        addi    a0,a0,%lo(.LC26)
258
        j       .L52
259
.L22:
260
        lui     a1,%hi(.LC27)
261
        addi    a1,a1,%lo(.LC27)
262
        mv      a0,s1
263
        call    strcmp
264
        bnez    a0,.L24
265
        lw      a0,16(sp)
266
        call    atoi
267
        mv      s1,a0
268
        lw      a0,20(sp)
269
        call    atoi
270
        mv      a1,a0
271
        mv      a0,s1
272
        call    __mulsi3
273
        mv      a1,a0
274
        lui     a0,%hi(.LC28)
275
        addi    a0,a0,%lo(.LC28)
276
        j       .L52
277
.L24:
278
        lui     a1,%hi(.LC29)
279
        addi    a1,a1,%lo(.LC29)
280
        mv      a0,s1
281
        call    strcmp
282
        bnez    a0,.L25
283
        lw      a0,16(sp)
284
        call    atoi
285
        mv      s1,a0
286
        lw      a0,20(sp)
287
        call    atoi
288
        mv      a1,a0
289
        sw      a0,4(sp)
290
        mv      a0,s1
291
        call    __modsi3
292
        lw      a5,4(sp)
293
        sw      a0,0(sp)
294
        mv      a0,s1
295
        mv      a1,a5
296
        call    __divsi3
297
        lw      a2,0(sp)
298
        mv      a1,a0
299
        lui     a0,%hi(.LC30)
300
        addi    a0,a0,%lo(.LC30)
301
.L53:
302
        call    printf
303
        j       .L28
304
.L25:
305
        lui     a1,%hi(.LC31)
306
        addi    a1,a1,%lo(.LC31)
307
        mv      a0,s1
308
        call    strcmp
309
        bnez    a0,.L26
310
        lw      a0,16(sp)
311
        call    atoi
312
        mv      s1,a0
313
        lw      a0,20(sp)
314
        call    atoi
315
        sw      a0,0(sp)
316
        lw      a0,24(sp)
317
        call    atoi
318
        lw      a1,0(sp)
319
        slli    a2,a0,16
320
        srai    a2,a2,16
321
        slli    a1,a1,16
322
        srai    a1,a1,16
323
        mv      a0,s1
324
        call    mac
325
        mv      a1,a0
326
        lui     a0,%hi(.LC32)
327
        addi    a0,a0,%lo(.LC32)
328
        j       .L52
329
.L26:
330
        lui     a1,%hi(.LC33)
331
        addi    a1,a1,%lo(.LC33)
332
        mv      a0,s1
333
        call    strcmp
334
        bnez    a0,.L27
335
        lw      a0,16(sp)
336
        call    xtoi
337
        mv      a1,a0
338
        srai    a2,a0,1
339
        lui     a0,%hi(.LC34)
340
        addi    a0,a0,%lo(.LC34)
341
        j       .L53
342
.L27:
343
        lbu     a5,0(s1)
344
        beqz    a5,.L28
345
        lui     a0,%hi(.LC35)
346
        mv      a1,s1
347
        addi    a0,a0,%lo(.LC35)
348
        j       .L52
349
.L50:
350
        lui     a0,%hi(.LC16)
351
        addi    a0,a0,%lo(.LC16)
352
        call    printf
353
        li      s0,999424
354
        addi    a0,s0,576
355
        call    usleep
356
        li      a0,46
357
        call    putchar
358
        addi    a0,s0,576
359
        call    usleep
360
        li      a0,46
361
        call    putchar
362
        addi    a0,s0,576
363
        call    usleep
364
        li      a0,46
365
        call    putchar
366
        lui     a0,%hi(.LC17)
367
        addi    a0,a0,%lo(.LC17)
368
        call    puts
369
        lw      ra,116(sp)
370
        lw      s0,112(sp)
371
        lw      s1,108(sp)
372
        li      a0,0
373
        addi    sp,sp,120
374
        jr      ra
375
        .size   main, .-main
376
        .section        .rodata.str1.4,"aMS",@progbits,1
377
        .align  2
378
.LC0:
379
        .string "+MT"
380
.LC1:
381
        .string ""
382
        .zero   3
383
.LC2:
384
        .string "+MAC"
385
        .zero   3
386
.LC3:
387
        .string "board: %s (id=%d)\n"
388
        .zero   1
389
.LC4:
390
        .string "Sun, 10 Jan 2021 18:33:44 -0200"
391
.LC5:
392
        .string "build: darkriscv fw build %s\n"
393
        .zero   2
394
.LC6:
395
        .string "rv32e"
396
        .zero   2
397
.LC7:
398
        .string "core0: darkriscv@%d.%dMHz with %s%s%s\n"
399
        .zero   1
400
.LC8:
401
        .string "uart0: 115200 bps (div=%d)\n"
402
.LC9:
403
        .string "timr0: periodic timer=%dHz (io.timer=%d)\n"
404
        .zero   2
405
.LC10:
406
        .string "Welcome to DarkRISCV!"
407
        .zero   2
408
.LC11:
409
        .string "> "
410
        .zero   1
411
.LC12:
412
        .string " "
413
        .zero   2
414
.LC13:
415
        .string "clear"
416
        .zero   2
417
.LC14:
418
        .string "\033[H\033[2J"
419
.LC15:
420
        .string "reboot"
421
        .zero   1
422
.LC16:
423
        .string "core0: reboot in 3 seconds"
424
        .zero   1
425
.LC17:
426
        .string "done."
427
        .zero   2
428
.LC18:
429
        .string "dump"
430
        .zero   3
431
.LC19:
432
        .string "%x: "
433
        .zero   3
434
.LC20:
435
        .string "%x "
436
.LC21:
437
        .string "led"
438
.LC22:
439
        .string "led = %x\n"
440
        .zero   2
441
.LC23:
442
        .string "timer"
443
        .zero   2
444
.LC24:
445
        .string "timer = %d\n"
446
.LC25:
447
        .string "gpio"
448
        .zero   3
449
.LC26:
450
        .string "gpio = %x\n"
451
        .zero   1
452
.LC27:
453
        .string "mul"
454
.LC28:
455
        .string "mul = %d\n"
456
        .zero   2
457
.LC29:
458
        .string "div"
459
.LC30:
460
        .string "div = %d, mod = %d\n"
461
.LC31:
462
        .string "mac"
463
.LC32:
464
        .string "mac = %d\n"
465
        .zero   2
466
.LC33:
467
        .string "srai"
468
        .zero   3
469
.LC34:
470
        .string "srai %x >> 1 = %x\n"
471
        .zero   1
472
.LC35:
473
        .string "command: [%s] not found.\nvalid commands: clear, dump <hex>, led <hex>, timer <dec>, gpio <hex>\n                mul <dec> <dec>, div <dec> <dec>, mac <dec> <dec> <dec>\n                rd[m][bwl] <hex> [<hex> when m], wr[m][bwl] <hex> <hex> [<hex> when m]\n"
474
        .ident  "GCC: (GNU) 9.0.0 20180818 (experimental)"

powered by: WebSVN 2.1.0

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