tree: 51be5ec0f4da18417c062e1c3bf83ffc8bdddf0b [path history] [tgz]
  1. data/
  2. doc/
  3. dv/
  4. ip/
  5. rtl/
  6. README.md
  7. top_earlgrey.core
  8. top_earlgrey_artys7-50.core
  9. top_earlgrey_nexysvideo.core
  10. top_earlgrey_usb.core
  11. top_earlgrey_usb_nexysvideo.core
  12. top_earlgrey_usb_verilator.cc
  13. top_earlgrey_usb_verilator.core
  14. top_earlgrey_verilator.cc
  15. top_earlgrey_verilator.core
  16. top_pkg.core
hw/top_earlgrey/README.md

Top Earlgrey

Tool: TopGen

Top Earlgrey is being generated by the integration tool, topgen (util/topgen.py). Please do not revise rtl/top_earlgrey.sv, the crossbar modules, and the interrupt controller directly. Those files are auto-generated and sit in the repo for browsing purpose.

How to create top module

Top module rtl/top_earlgrey.sv is created by topgen.py. Current top module is created with below command.

../../util/topgen.py -t doc/top_earlgrey.hjson -c doc -o . -v

It generates files below:

  • rtl/top_earlgrey.sv: Top module generated from the template doc/top_earlgrey.tpl.sv with the configuration file doc/top_earlgrey.hjson
  • rtl/xbar_main.sv and rtl/tl_main_pkg.sv: Crossbar module. As of now, earlgrey has only one main crossbar. tlgen library is used to generate these files.
  • rtl/rv_plic*.sv and doc/rv_plic.hjson: Interrupt controller module. hw/ip/rv_plic/doc/reg_rv_plic.py tool is used to create RV_PLIC having the number of interrupts specified in the hjson.

Adding new blocks into top level

Modify doc/top_earlgrey.hjson to include new module

  • If new block has interrupts, also add to the interrupt_module definition

Modify xbar_main.hjson for the host / device connectivity

Modify configurations

Main configuration for Top Earlgrey is in doc/top_earlgrey.hjson. The users need to specify the list of peripherals, memories, crossbars, and the interrupts in the configuration file. The tool then reads relavant information from the each peripheral blocks' configuration. For instance, if uart module is used, the tool reads hw/ip/uart/doc/uart{_reg}.hjson and parses the information such as input/output, the size of its register space, and interrupts.

For the memories, the tool utilizes the type and instantiates relavant modules including the converter from TL-UL interface to the native interfaces (SRAM, ROM, eFlash). The user only needs to describe the base address and the memory size.

The crossbar should be defined in the separate file. Please take a look at doc/xbar_main.hjson as an example. In the top configuration, it needs to define the xbar and the clock, then the tool calls tlgen library to create the crossbar design. Please remind that the instance name in the crossbar and that in the module field should be matched for topgen to create fields that tlgen uses.

Modify the template

Main top template file is doc/top_earlgrey.tpl.sv. In most cases, it isn't require to modify the template file. For instance, to add new IP into the top, the user just needs to add the IP to the module field and revise the crossbar connections in the crossbar configuration.

There might be some cases that needs to revise the template. As of now, a few modules are hard-coded such as RISC-V core and the debug module. If any of these modules need to be revised or some new modules not matching to the comportability spec, it needs to be manually instantiated in the template file.