[otbn-as] Generate .line numbers to fix up DWARF information

To try this out, run something like this from the hw/ip/otbn/util
directory:

  ./otbn-as -g -o tmp.o ../dv/otbnsim/test/simple/pseudos/li.s
  ./otbn-objdump -dS tmp.o

The result looks like this:

  00000000 <.text>:
      expansion was correct is a little difficult, unless you can run the
      generated instructions... which is what we can do for ISS testing. So the
      checks seem to fit quite well here.

  */
    li x2, 1230
     0:   4ce00113                li      sp,1230
    li x3, -123
     4:   f8500193                li      gp,-123
    li x4, 2272
     8:   00001237                lui     tp,0x1
     c:   8e020213                addi    tp,tp,-1824 # 8e0 <.text+0x8e0>

    /* Big immediates that can be done with a single LUI */
    li x5, 1048576
    10:   001002b7                lui     t0,0x100
    li x6, -0x800000
    14:   ff800337                lui     t1,0xff800

As a bonus, this commit also slightly improves how we print
instructions that we've assembled or pseudo-instructions that we've
expanded. This won't make any difference unless debugging
otbn-as (with the --otbn-translate flag), but it should make li
instructions a bit less confusing when that happens.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
1 file changed
tree: db8f652915c13c1f9e1452ea268f958d2c48f0ca
  1. .github/
  2. ci/
  3. doc/
  4. hw/
  5. site/
  6. sw/
  7. test/
  8. util/
  9. .clang-format
  10. .dockerignore
  11. .flake8
  12. .gitignore
  13. .style.yapf
  14. .svlint.toml
  15. .svls.toml
  16. _index.md
  17. apt-requirements.txt
  18. azure-pipelines.yml
  19. check_tool_requirements.core
  20. CLA
  21. COMMITTERS
  22. CONTRIBUTING.md
  23. LICENSE
  24. meson.build
  25. meson_init.sh
  26. meson_options.txt
  27. python-requirements.txt
  28. README.md
  29. tool_requirements.py
  30. toolchain.txt
  31. topgen-generator.core
  32. topgen-reg-only.core
  33. topgen.core
  34. yum-requirements.txt
README.md

OpenTitan

OpenTitan logo

About the project

OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.

About this repository

This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.

Documentation

The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.

How to contribute

Have a look at CONTRIBUTING for guidelines on how to contribute code to this repository.

Licensing

Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).