blob: 8b49d46496e438967f024602d26013c1b4c62ec4 [file] [log] [blame]
Rupert Swarbricka2789b02020-07-24 18:25:28 +01001/* Copyright lowRISC contributors. */
2/* Licensed under the Apache License, Version 2.0, see LICENSE for details. */
3/* SPDX-License-Identifier: Apache-2.0 */
4/*
5 An example of the pseudo-operations supported by the OTBN ISA
6*/
Rupert Swarbrick9b1392e2021-10-26 17:39:34 +01007.section .text.start
Rupert Swarbricka2789b02020-07-24 18:25:28 +01008
9nop_example:
10 /* NOP is a no-op, and expands to addi x0, x0, 0 */
11 nop
12
13ret_example:
14 /* RET is a return and expands to jalr x0, x1, 0 */
15 ret
16
17li_example:
18 /* LI is a bit more complicated. With a small immediate, it turns
19 into just addi */
20 li x2, 1230
21 li x2, -123
Rupert Swarbrickc35c5202020-10-06 08:41:08 +010022 li x2, 2272
Rupert Swarbricka2789b02020-07-24 18:25:28 +010023
24 /* With a big immediate which happens to have nothing set in the
25 lower 20 bits, it turns into just a LUI */
26 li x2, 1048576
27 li x2, -0x800000
28
29 /* With a big immediate in general, we need 2 instructions.
30 Firstly, a LUI to set up the upper bits, then an ADDI to sort out
31 the lower ones. */
32 li x2, 0x10000042
33
34 li x2, 123456789
35 li x2, 0x7fffffff