Newad is a register map automation tool for Verilog designs that was created to address the repetitive and error-prone nature of manually managing large sets of runtime configurable registers in complex FPGA designs. It parses Verilog code to automatically generate a register map, bus decoders, and documentation. This avoids the need for developers to manually track registers and write repetitive decoder code or maintain separate description files. The goal is to make register management scalable as designs increase in size and complexity.
Newad is a register map automation tool for Verilog designs that was created to address the repetitive and error-prone nature of manually managing large sets of runtime configurable registers in complex FPGA designs. It parses Verilog code to automatically generate a register map, bus decoders, and documentation. This avoids the need for developers to manually track registers and write repetitive decoder code or maintain separate description files. The goal is to make register management scalable as designs increase in size and complexity.
Newad is a register map automation tool for Verilog designs that was created to address the repetitive and error-prone nature of manually managing large sets of runtime configurable registers in complex FPGA designs. It parses Verilog code to automatically generate a register map, bus decoders, and documentation. This avoids the need for developers to manually track registers and write repetitive decoder code or maintain separate description files. The goal is to make register management scalable as designs increase in size and complexity.
Lawrence Berkeley National Lab Lawrence Berkeley National Lab Berkeley, California, USA Berkeley, California, USA vkvytla@lbl.gov lrdoolittle@lbl.gov
alone repetitive, can also be error prone demanding a
Abstract—Large scale scientific instrumentation-and-control register map code generation engine. FPGA gateware designs have numerous run-time settable 2. Bus decoder: Manually decoding several register values from a system bus (address and data lines) is a tedious arXiv:2305.09657v1 [cs.AR] 16 May 2023
parameters. These can be used either for user-level control
or by automated processes (e.g., calibration). The number task. In addition to the decoding, developer needs to of such parameters in a single design can reach on the order decide in which module should she instantiate the de- of 1000, and keeps evolving as the gateware and its func- tionality evolves. One must keep track of which module the coder. This is especially tedious in an evolving design. registers belong to, where the registers need to be decoded, We propose an engine that instantiates the bus decoder and how to express the properties (or even semantics) of at a requested level at pre-compile time. The developer the register to the next level of user or software. Note, may optionally choose, to provide some register values the registers maybe embedded anywhere throughout the as readback to the user of the design, depending on module hierarchy. Purely manual handling of these tasks by HDL developers is considered burdensome and error-prone the resources available. It is preferable to manage such at this scale. Typically these registers are writable via an on- register decoding/encoding in an automated way. chip bus, vaguely VME-like, that is controlled by an on-chip 3. Register attributes: IEEE register attributes, defined [2]. or off-chip CPU. There have been several attempts in the Registers have several attributes that a user is expected community to address this task at different levels. However, we have found no tool that is able to generate a register map, to be aware of such as it’s size, read-only nature, bit generate decoders and encoders with minimal overhead descriptions, clock domain, a physical formula it relates to the developer. So, here we present a tool that scours to, and a human readable description (documentation). native HDL source files and looks for specific language- The goal is to automatically gather such attributes and supported attributes and automatically generates a register present it to both the end user (in a readable format like map and bus decoders, respecting multiple clock domains, and presents a JSON file to the network that maps register PDF) and to other software (in a machine comprehensible names to addresses. format like a c-Header/JSON). 4. Documentation generation: Developers don’t need to Index Terms—Verilog; VerilogHDL; VHDL; Regsiter map; Automation; Address map; Code generation write documentation outside the source code. All modern languages and tools allow for this. Given code for registers Overview and memory maps can be generated from source code, the documentation about them should be generated as well. The document describes newad [3], our address map code gen- eration tool for VerilogHDL designs. Initially, we describe the With the above motivation in mind, and working with Ver- motivation for developing such a tool, followed by commenting ilogHDL over the years, we have written a developer tool on some design considerations and the design itself. Finally, we called newad that parses Verilog code pre-compile time, and describe the tool in some detail, ending with a conclusion of accomplishes many of the above tasks. what we think we achieved and what can be done in the future. Design Introduction The register map automation started out of necessity as the Motivation designs were steadily increasing in size. Our initial attempt at code generation, was achieved by the developer placing Larger experiments demand larger register map sets. This “magic”-comments throughout a Verilog project. newad looked section elaborates a few reasons of why develop a register map for these comments and generated the necessary register map, code generation tool. and bus decoders. Relying on comments from source files isn’t a great strategy. Knowing this we looked around for other tools 1. Repetitive and error prone: With the FPGA LUT count that have solved the problem ever increasing, gateware designs today are larger than ever. This invariably leads to a large set of regis- We came across Cheby [1] developed by engineers at CERN ters/register maps that are managed from software. When (European Organization for Nuclear Research). Cheby works lacking automation, the developer manually tracks reg- by requiring the developer to maintain a parallel file to each isters during development or maintenance cycles where source file, where the registers being used in the source file new registers are created, removed, and various attributes are described in YAML. Cheby then source agnostically parses about them are constantly changing. This process let the register (YAML) file and is capable of generating a C header/Documentation/HDL instantiation of the YAML rep- resentation. This more or less solves the problems we have This work was presented at the 3rd Workshop on discussed above, all the while introducing new ones. Open-Source Design Automation (OSDA) 2023, co-hosted with Design, Automation, and Test in Europe A serious limitation to Cheby is the requirement that the user Conference (DATE) 2023 in Antwerp, Belgium, on April 17, needs to maintain a YAML file describing registers. This adds 2023. For further information and material, please visit the paper’s overhead to the developer where now she needs to look into web page on the workshop website at https://osda.ws/r/ifIbv more than one file for the truth. Readability is affected. (just scan the QR code on the right). The copyright is retained by the authors. This work is licensed under the terms of the After continuing to look for other options the authors decided Creative Commons Attribution license (CC BY), version 4.0, see https://creativecommons.org/licenses/by/4.0. Proceedings of the 3rd to leverage using language attributes to encode information Workshop on Open-Source Design Automation (OSDA), Pages 5–6, that was being put inside magic-comments. Attributes make 2023. this a lot cleaner. Verilog attributes are defined to be rather simple but clean and allow for cleanly encoding lots of register .. related information. Second, addr_map_station.vh is a generated file that strictly To leverage the usage of attributes, and successfully parse includes the address map that was generated by newad. them, it made sense to use an existing Verilog parser. In order to accomplish this, we looked at iverilog and Yosys parsers. // addr_map_station.vh Attribute parsing wasn’t sufficiently implemented in either of `define LB_HI 14 those open source parsers, and it took a few contributions from .. the authors to add the necessary features. After using both, we // prng_iva bw: 0, base_addr: 7203 stuck with Yosys, for both technical and licensing reasons. `define HIT_prng_iva (lb_addr[`LB_HI:0]==7203) // prng_run bw: 0, base_addr: 7205 Project Details `define HIT_prng_run (lb_addr[`LB_HI:0]==7205) Registers A JSON file is generated as an API for a top-level software to Registers maybe marked as “automatic” using an attribute be able to access the register info. in any module of the design hierarchy. Registers are marked automatic at module definition site, as shown in the code .. sample below. "prng_iva": { "access": "rw", A developer may also notify newad to generate additional "addr_width": 0, register logic, such as a write strobe for the register, a read "base_addr": 7203, strobe, a signal that holds the write value only for single cycle, "data_width": 32, etc. "description": "", module prng( "sign": "unsigned" input clk, }, output [31:0] rnda, "prng_run": { output [31:0] rndb, "access": "rw", (* external *) "addr_width": 0, input [0:0] run, "base_addr": 7205, (* external, signal_type="plus-we" *) "data_width": 1, input [31:0] iva, "description": "", input iva_we, // special trailing _we "sign": "unsigned" } ); .. Module instances Decoder generation If a module has any registers described as “automatic”, it is Once newad is notified of a top-level Verilog file, and recursively expected that signals/wires for the register need to be routed searches paths for the modules utilized in the design, newad through its module instantiation site. When the developer builds a tree with per-module register information. It can marks the instantiation site with “automatic”, newad then then generate a bus decoder upon programmer’s command. generates a macro for that instantiation site. The macro con- Generated code for the decoder is embedded in a macro which tains wires for the automatic registers of to the module being is utilized at the intended module. instantiated. Conclusion (* lb_automatic *) prng prng ( We believe large, complex projects need a robust scheme to .clk(clk), manage their register space. Languages like Verilog, VHDL, .rnda(rnda), and bSystem Verilog that can’t cleanly express such semantics .rndb(rndb) natively demand a tool like Cheby or newad. newad initially `AUTOMATIC_prng emerged out of necessity and evolved into something that is ); actively supporting several gateware projects. We have seen at least one modern HDL language such as (n)-migen (a Python Verilog header files based DSL for describing gateware), where such register map newad is run as a pre-compile step. Once newad is run the generation is fully embedded into the language inside a library. macros are populated inside generated header files. The devel- oper is expected to include these header files. This strictly keeps We intend to release newad as a stand-alone package for reg- all generated code away from source. We are still considering ister map automation. Currently, it is embedded inside our a scheme where newad generates a single Verilog file with all framework as a build tool here. We believe such register map modules it has parsed and the generated code. automation could be done for VHDL as well. However, VHDL doesn’t play very well with header files. Continuing with the example above, for the sake of simplic- ity let’s say the prng module was included in a top-level newad is an HDL-developer-centric approach to register space file, known as station. The following automatically generated management. It focuses on HDL readability and maintainabil- header files can be included inside station.v. First we will ity, and a single-source-of-truth for generating register maps look at station_auto.vh which is a headerfile expected to be and their documentation. included with station.v. References // station_auto.vh // parse_vfile_yosys station.v [1] Dimitris Lampridis et al. Cheby. 2018. url: .. https://gitlab.cern.ch/be-cem-edl/common/cheby. // module=prng instance=prng gvar=None gcnt=None [2] IEEE 1364-2001 Standard, IEEE Standard Verilog // parse_vfile_yosys :station.v ./prng.v Hardware Description Language. 2001. url: `define AUTOMATIC_prng .run(prng_run),\ https://inst.eecs.berkeley.edu/~cs150/fa06/Labs/verilog-ieee.pdf,. .iva_we(prng_iva_we),\ [3] Larry Doolittle Vamsi K Vytla. Newad. 2023. url: .iva(prng_iva),\ https://github.com/BerkeleyLab/Bedrock/blob/master/build-tools/ne
Software Containers: The Complete Guide to Virtualization Technology. Create, Use and Deploy Scalable Software with Docker and Kubernetes. Includes Docker and Kubernetes.
Docker: The Complete Guide to the Most Widely Used Virtualization Technology. Create Containers and Deploy them to Production Safely and Securely.: Docker & Kubernetes, #1