Coder Social home page Coder Social logo

rggen / rggen-sample-testbench Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 3.0 248 KB

Home Page: https://github.com/rggen/rggen

License: MIT License

Shell 0.02% SystemVerilog 26.28% Makefile 0.60% Verilog 33.27% VHDL 39.79% Ruby 0.04%
systemverilog uvm uvm-ral-model uvm-register-model verilog vhdl

rggen-sample-testbench's Introduction

RgGen

Gem Version CI Maintainability codecov Gitter

ko-fi

RgGen

RgGen is a code generation tool for ASIC/IP/FPGA/RTL engineers. It will automatically generate source code related to control and status registers (CSR), e.g. SytemVerilog RTL, UVM register model (UVM RAL/uvm_reg), C header file, Wiki documents, from human readable register map specifications.

RgGen has following features:

  • Generate source files related to CSR from register map specifications
    • RTL module
      • SystemVerilog
      • Verilog
      • VHDL
      • Supports standard bus protocols
        • AMBA APB
        • AMBA AXI4-Lite
        • Wishbone
    • UVM register model (UVM RAL/uvm_reg)
    • C header file
    • Register map documents written in Markdown
  • Register map specifications can be written in human readable format
    • Ruby with APIs to describe register map information
    • YAML
    • JSON
    • TOML
    • Spreadsheet (XLSX, ODS, CSV)
    • SiFive DUH
  • Plugin feature
    • Allow you to customize RgGen for your environment
      • Add your own special bit field types
      • Add your own host bus protocol

Installation

Ruby

RgGen is written in the Ruby programing language and its required version is 3.0 or later. You need to install any of these versions of Ruby before installing RgGen tool. To install Ruby, see this page.

Installatin Command

RgGen depends on following sub components and other Ruby libraries.

To install RgGen and the dependencies, use the command below:

$ gem install rggen

RgGen and dependencies will be installed on your system root.

If you want to install them on other location, you need to specify install path and set GEM_PATH and PATH environment variables:

$ gem install --install-dir /path/to/your/install/directory rggen
$ export GEM_PATH=/path/to/your/install/directory
$ export PATH=$GEM_PATH/bin:$PATH

You would get the following error message duaring installation if you have the old RgGen (version < 0.9).

ERROR:  Error installing rggen:
        "rggen" from rggen-core conflicts with installed executable from rggen

To resolve the above error, there are three solutions. See this page

Docker Image

The rggen-docker is a Docker image to simplify installation and use of RgGen. You can also execute RgGen by using this image:

$ docker run -ti --rm -v ${PWD}:/work --user $(id -u):$(id -g) rggendev/rggen-docker:latest -c config.yml -o out block_0.yml

See the rggen-docker repository for further details.

Usage

See Wiki documents.

Plugin

RgGen has plugin feature to allow your cusomization. See this Wiki document for futher detals.

Supported Tools

Following EDA tools can accept the generated source files.

  • Simulation tools
    • Synopsys VCS
    • Cadence Xcelium
    • Metrics DSim
    • Xilinx Vivado Simulator
    • Verilator
      • Need -Wno-unoptflat switch for Verilog RTL
    • Icarus Verilog
      • Verilog RTL only
  • Synthesis tools
    • Synopsys Design Compiler
    • Intel Quartus
    • Xilinx Vivado
    • Yosys
      • Verilog RTL

Example

You can get sample configuration file and register map specification from the rggen-sample repository. This register map specification is for a UART IP.

You can try to use RgGen by uisng these example files. Hit command below:

$ rggen -c config.yml -o out uart_csr.yml
  • -c: Specify path to your configuration file
  • -o: Specify path to the directory where generated files will be written to

Then, generated files will be written to the out directory.

If you want to generate Verilog RTL and/or VHDL RTL then you need to instll optional plugins listed below.

$ gem install rggen-verilog
$ gem install rggen-vhdl

In addition, you need to tell RgGen to use these plugins by using the --plugin option switch:

rggen -c config.yml --plugin rggen-verilog --plugin rggen-vhdl uart_csr.yml

RgGen will generate following source files from the uart_csr.yml register map specification:

Contributing

See Contributing Guide.

Contact

Feedbacks, bug reports, questions and etc. are wellcome! You can post them by using following ways:

See Also

Copyright & License

Copyright © 2019-2024 Taichi Ishitani. RgGen is licensed under the MIT License, see LICENSE for futher detils.

Code of Conduct

Everyone interacting in the RgGen project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

rggen-sample-testbench's People

Contributors

taichi-ishitani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rggen-sample-testbench's Issues

Can use VCS

I use VCS to run this testbench.
I use command : make , in directory "rggen-sample-testbench-master/sim/apb/verilog"

But I have error as following:

make sim_vcs TEST=ral_hw_reset_test
make[1]: Entering directory '/home/jamesning/work/reggen/rggen-sample-testbench-master/sim/apb/verilog'
[ -f simv ] || make compile_vcs
make[2]: Entering directory '/home/jamesning/work/reggen/rggen-sample-testbench-master/sim/apb/verilog'
vlogan -full64 -sverilog -timescale=1ns/1ps -ntb_opts uvm-1.2 -l vlogan_uvm.log

Warning-[MXIR-W] VCS-MX build is required
Please make sure that vlogan is from the intended build.

                     Chronologic VCS (TM)
   Version O-2018.09-SP2_Full64 -- Thu Aug 24 13:32:38 2023
           Copyright (c) 1991-2018 by Synopsys Inc.
                     ALL RIGHTS RESERVED

This program is proprietary and confidential information of Synopsys Inc.
and may be used and disclosed only as authorized in a license agreement
controlling such use and disclosure.

Error-[ILWOR] Incorrect Logical Worklib or Reflib
The incorrect logical lib is "work".
Please check your Synopsys setup file.

CPU time: .110 seconds to compile
make[2]: *** [/home/jamesning/work/reggen/rggen-sample-testbench-master/sim/vcs.mk:69: compile_vcs] Error 255
make[2]: Leaving directory '/home/jamesning/work/reggen/rggen-sample-testbench-master/sim/apb/verilog'
make[1]: *** [/home/jamesning/work/reggen/rggen-sample-testbench-master/sim/vcs.mk:64: sim_vcs] Error 2
make[1]: Leaving directory '/home/jamesning/work/reggen/rggen-sample-testbench-master/sim/apb/verilog'
make: *** [makefile:32: ral_hw_reset_test] Error 2

Would you please help me to fix the bug?

Error : uninitialized virtual interface object in rggen_ral_backdoor_pkg

Hi,
I'm using the rggen generated models for our design and verification.

And I'm using AXI interface, for which I'm using AXI VIP for verification. when I'm trying to start uvm_reg_access_seq I'm getting the following error.
image

the corresponding line is:
image

Please help me in solving this issue..

Thanks.

Regards,
Tejoyadav

HiZ inputs to rggen_default_register

Hello,

If a register implements fewer bits than the bus width, then some portion of input signals, i_bit_field_value and i_bit_filed_read_data, to rggen_default_register are HiZs.

To avoid this, could rggen be updated to pass the correct width(sum of bit_field widths) to DATA_WIDTH parameter instead if setting that parameter to BUS_WIDTH? Would that have any other side effects and cause functional issues?

UVM file error

Hi,
After fix some error, I still have this error when I run make in direction rggen-sample-testbench/sim/apb/verilog :

This program is proprietary and confidential information of Synopsys Inc.
and may be used and disclosed only as authorized in a license agreement
controlling such use and disclosure.

Parsing design file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_pkg.sv'
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_version_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_global_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_message_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_phase_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_object_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_printer_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_tlm_defines.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/tlm1/uvm_tlm_imps.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_tlm_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_sequence_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_callback_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_reg_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Parsing included file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/macros/uvm_deprecated_defines.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_macros.svh'.
Back to file '/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_pkg.sv'.

Error-[SE] Syntax error
Following verilog source has syntax error :
"/usr/synopsys/vcs2018.09/vcs/O-2018.09-SP2/etc/uvm-1.2/uvm_pkg.sv", 32:
token is ';'
package uvm_pkg;
^

1 error
CPU time: .161 seconds to compile
make[2]: *** [/home/jamesning/work/reggen/rggen-sample-testbench/sim/vcs.mk:74: compile_vcs] Error 255
make[2]: Leaving directory '/home/jamesning/work/reggen/rggen-sample-testbench/sim/apb/verilog'
make[1]: *** [/home/jamesning/work/reggen/rggen-sample-testbench/sim/vcs.mk:64: sim_vcs] Error 2
make[1]: Leaving directory '/home/jamesning/work/reggen/rggen-sample-testbench/sim/apb/verilog'
make: *** [makefile:31: ral_hw_reset_test] Error 2

Would you please tell me how to solve it? Thank you

Error poped when simulating the example test

the error message:

CPU time: .989 seconds to compile
make dut.f
make[3]: Entering directory /home/kevin/work/rggen/rggen-sample-testbench/sim/apb/verilog' flgen --output=dut.f --define-macro=RGGEN_VERILOG --define-macro=RGGEN_ENABLE_SVA --define-macro=RGGEN_ENABLE_BACKDOOR --define-macro=RGGEN_ENABLE_ENHANCED_RAL /home/kevin/work/rggen/rggen-sample-testbench/rtl/compile.rb no such file or directory -- rggen-verilog-rtl/compile.rb @/home/kevin/work/rggen/rggen-sample-testbench/rtl/compile.rb:7 make[3]: *** [dut.f] Error 1 make[3]: Leaving directory /home/kevin/work/rggen/rggen-sample-testbench/sim/apb/verilog'
make[2]: *** [compile_vcs] Error 2
make[2]: Leaving directory /home/kevin/work/rggen/rggen-sample-testbench/sim/apb/verilog' make[1]: *** [sim_vcs] Error 2 make[1]: Leaving directory /home/kevin/work/rggen/rggen-sample-testbench/sim/apb/verilog'
make: *** [ral_hw_reset_test] Error 2

Hi, I appreciated what you did!
I am trying the sample tb but I cannot find the files poped in terminal. I saw the folders and files located in the root folder of the sample tb repo. I don't know why it poped error.

case ENV['LANGUAGE']
when 'systemverilog'
file_list 'rggen-sv-rtl/compile.rb', from: :current
source_file "#{ENV['PROTOCOL']}/block_0.sv"
source_file "#{ENV['PROTOCOL']}/block_1.sv"
when 'verilog'
file_list 'rggen-verilog-rtl/compile.rb', from: :current
source_file "#{ENV['PROTOCOL']}/block_0.v"
source_file "#{ENV['PROTOCOL']}/block_1.v"
when 'vhdl'
file_list 'rggen-vhdl-rtl/compile.rb', from: :current
source_file "#{ENV['PROTOCOL']}/block_0.vhd"
source_file "#{ENV['PROTOCOL']}/block_1.vhd"
end

this is the file who will find the needed things.

I am not familiar with ruby, please help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.