commit | 75e5b98e3d9e8804b7b55d042092c19d2aad425c | [log] [tgz] |
---|---|---|
author | Rupert Swarbrick <rswarbrick@lowrisc.org> | Mon Aug 17 16:29:16 2020 +0100 |
committer | Rupert Swarbrick <rswarbrick@gmail.com> | Thu Aug 27 08:40:17 2020 +0100 |
tree | 387e80e7afc4897c88fb8c0667351b741abd44a3 | |
parent | 60fd43f8b21c4d85651ab4bf30babce24af3a4b2 [diff] |
[otbn] Split up JSON dumping/loading in otbn-rig This is a bit verbose, because we're properly parsing JSON data back to ProgInsn objects, so have to do various sanity checks on the way to make sure all the types match up. The core of the patch is in the otbn-rig script, where we change the command line to have two subcommands: 'gen' and 'asm'. Running 'gen' will generate some JSON that describes the snippets in a random instruction stream. Feeding that JSON to 'asm' generates assembly code that can be assembled into a binary for testing. This isn't quite so handy to use if you "just want to generate a darn asm file!", but it's the shape we're going to use in the future and running things in two stages like this will spot any silly mistakes in the JSON parsing. Here's an example of how to run it to generate a small example: hw/ip/otbn/util/otbn-rig gen --size 10 -o tst.json hw/ip/otbn/util/otbn-rig asm -o tst tst.json This example can be assembled and linked with: hw/ip/otbn/util/otbn-as tst.S -o tst.o hw/ip/otbn/util/otbn-ld -o tst -T tst.ld tst.o If you just want to see some assembly, the 'gen' phase will print its JSON to stdout if not given an '-o' argument, the 'asm' phase will read from stdin if not given a JSON file, and will print just the assembly to stdout. So you can run: hw/ip/otbn/util/otbn-rig gen --size 10 | \ hw/ip/otbn/util/otbn-rig asm Of course, this doesn't generate a linker script, so this is only useful for quick checks. Chaining like this does: hw/ip/otbn/util/otbn-rig gen --size 10 | \ hw/ip/otbn/util/otbn-rig asm -o tst (but you no longer get to keep the JSON intermediate file). Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
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.
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.
The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.
Have a look at CONTRIBUTING for guidelines on how to contribute code to this repository.
Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).