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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [blink_led/] [blink_led_in_asm.S] - Blame information for rev 35

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

Line No. Rev Author Line
1 23 zero_gravi
.file   "blink_led_in_asm.S"
2
.section .text
3
.balign 4
4
.global blink_led_asm
5
 
6
blink_led_asm:
7
 
8
  /* base address of GPIO controller's output port is passed as argument (in a0)*/
9
  sw   zero, 0(a0) /* clear output port */
10
 
11
  li   t1, 0 /* initialize counter */
12
 
13
 
14
blink_loop:
15
  andi t1, t1, 255 /* apply 8-bit mask */
16
  sw   t1, 0(a0)   /* output current counter value */
17
  addi t1, t1, 1   /* increment counter */
18
 
19
  jal  ra, blink_delay /* call delay function */
20
 
21
  j    blink_loop
22
 
23
 
24
blink_delay:
25
  li   t2, 0xfffff /* delay time */
26
 
27
blink_delay_loop:
28
  beq  t2, zero, blink_delay_end
29
  addi t2, t2, -1
30
  nop
31
  nop
32
  j    blink_delay_loop
33
 
34
blink_delay_end:
35
  ret
36
 
37
.end

powered by: WebSVN 2.1.0

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