Jump to content

Recommended Posts

Posted

Hi,

When using ralfgen to generate uvm register models, the whole model is generated in one big file, include all the submodules.

This affect the reusability. I would prefer to reuse model that were generated for submodules instead.

 

As an example, here is a basic hierachical structure of a system:

 

Module A

 |-Module x

 

with their corresponding ralf file:

 

ModuleA_regmodel.ralf:

source Modulex.ralf

system ModuleA_regmodel {
  bytes 4

  block  Modulex = my_modulex@0X000000
}

Modulex_regmodel.ralf:

block Modulex_regmodel{
    bytes 4
    register dummy  {
        bytes 4;
    }
}

Running ralfgen will give me the following uvm regmodel in moduleA_regmodel.sv

`ifndef RAL_MODULEA_REGMODEL
`define RAL_MODULEA_REGMODEL

import uvm_pkg::*;

class ral_reg_modulex_regmodel_dummy extends uvm_reg;
[...]
endclass : ral_reg_modulex_regmodel_dummy


class ral_block_modulex_regmodel extends uvm_reg_block;
[...]
endclass : ral_block_modulex_regmodel


class ral_sys_modulea_regmodel extends uvm_reg_block;
[...]
endclass : ral_sys_modulea_regmodel

`endif

Now, for reusability, it would be preferrable to have two files instead:

modulex_regmodel.sv

`ifndef RAL_MODULEA_REGMODEL
`define RAL_MODULEA_REGMODEL

import uvm_pkg::*;

class ral_reg_modulex_regmodel_dummy extends uvm_reg;
[...]
endclass : ral_reg_modulex_regmodel_dummy

class ral_block_modulex_regmodel extends uvm_reg_block;
[...]
endclass : ral_block_modulex_regmodel

`endif

moduleA_regmodel.sv

`ifndef RAL_MODULEA_REGMODEL
`define RAL_MODULEA_REGMODEL

import uvm_pkg::*;

class ral_sys_modulea_regmodel extends uvm_reg_block;
   rand ral_block_modulex_regmodel my_modulex;

[...]
endclass : ral_sys_modulea_regmodel

`endif

Now, is there a way to generate moduleA_regmodel as is, without deleting the modulex_regmodel class declaration after each generation?

I was thinking of having a modulex_regmodel_empty.ralf:

block Modulex_regmodel{
}

And source it in ModuleA_regmodel.ralf, but I get an error.

 

Other ideas?

Thank you!

 

  • 2 weeks later...
Posted

Hi,

 

You can control generation of regmodel by passing option -T/-F to ralgen.

 

Consider the following RALF specificaiton:

block blk1 {   register R1 {...};}block blk2 {   register R2 {...};}system sys {   block blk1;   block blk2;}

1) To split different block in different files, you can add the option '-F' to ralgen command line. With this option:

Instead of generating the complete model into a single file named "ral_topblkname.sv", the generated register model will be split into individual files, one per block. The individual files can then be used in the verification environments of the corresponding blocks

 

 

2) To generate register model for only "sys" (top block), you can pad the ralgen command line with option '-T'. The option causes the generation of the register model for the specified top-most block.

 

In the example RALF specified above, this option would generate the model file for the top-most block (system sys) within: "ral_sys.sv". The generated model would contain include directives to include "ral_blk1.sv" & "ral_blk2.sv". It would be necessary to specify either -F or -P to use this option.

 

Thanks,
Tarun

  • 1 month later...
Posted

Hi Tarun,

Thank you for your answer. I cannot find any -F, -P or -T options in the ralgen help menu.

 

When I try to run the cmd:

ralgen -T -uvm -l sv -t ral_top -o ral_top ral_top.ralf

I am getting: "Error: Unknown option character 'T' specified"
 

I am using version 2013_06 of ralgen.

 

The "ralgen -h" commands does not help me further...

 

Any idea?

 

Thanks

 

Florian

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...