uvm_code_gen
uvm_code_gen copied to clipboard
Simple template-based UVM code generator
⚡️ uvm_code_gen
Simple template-based UVM code generator.
💡 Rationale
UVM is great for reuse and standardization of RTL verification.
However, it is very verbose.
uvm_code_gen generates a full UVM testbench skeleton based on simple configuration files.
Once generated, we only have to write a couple of lines to finish it.
✨ Features
uvm_code_gen generates the following code:
- VIPs (agent, interface, sequence, coverage)
- top-level environment
- testbench
- env (scoreboard, VIP, coverage)
- virtual sequence
- run script
🚀 Usage
Basic
./main.py examples/fifo/fifo_in.conf examples/fifo/fifo_out.conf
Generated files are in ./output.
run simulation
- create
bin/dut_files.f - edit dut instantiation in
top/tb/top_th.sv cd binand./run
edit to your liking
- VIP
- clocking blocks in
vip/*/*_if.sv do_drive()invip/*/*_driver.svdo_mon()invip/*/*_monitor.sv
- clocking blocks in
- TOP
write_from_*()intop/top_scoreboard.svtop/top_seq_lib.sv
Advanced
top_env_name
# top-level environment default name is "top"
./main.py examples/fifo/fifo_in.conf examples/fifo/fifo_out.conf
# top-level environment name is "fifo"
./main.py examples/fifo/fifo_in.conf examples/fifo/fifo_out.conf -t fifo
top_map
By default:
- each VIP is instiated once
- instance name is the name of the VIP
This can be changed using the --top_map option.
# multiple instances of the VIPs
./main.py examples/noc/*.conf --top_map examples/noc/top.map
# you can also refer to VIPs that are not defined by a config file:
# - the top-level env/scoreboard/etc will be correctly generated
# - the VIP directory won't be generated
./main.py --top_map examples/noc/top.map
has_master_and_slave
Adding has_master_and_slave = 1 in the configuration file will
- add
*_master_driver.svand*_slave_driver.sv - add
is_masterfield in the VIP's config class and use it in the*_agent.sv - set
is_masterin thetop_config.svto 1 if the instance name matches master - add a master and slave instance by default (unless
--top_mapis used)
./main.py examples/handshake/handshake.conf
🚧 TODO
- change seq name to something less generic ?
- change convert2string() formatting ?
🙏 Credits
The UVM code generation and coding guidelines are heavily inspired by Doulos' easier_uvm.
Thanks a lot to all the contributors.