Skip to content

uvm_map configure does not add the map #29

@RasmusGOlsen

Description

@RasmusGOlsen

When you configure a uvm_map, it is not added to the block specified as its parent. You must explicitly call add_map, although this is not part of the standard API.

import uvm_pkg::*;


class Reg extends uvm_reg;

    function new(string name, int width=32);
        super.new(name, width, UVM_NO_COVERAGE);
    endfunction

endclass


class Block extends uvm_reg_block;

    Reg a;
    uvm_reg_map map;

    function new(string name);
        super.new(name);
        this.a = new("a");
        this.a.configure(this, null, "");
        // this.map = this.create_map("map", 0, 4, UVM_LITTLE_ENDIAN, 0);
        this.map = new("map");
        this.map.configure(this, 0, 4, UVM_LITTLE_ENDIAN, 0);
        this.map.add_reg(this.a, 0, "RW", 0);
        // this.add_map(this.map);
    endfunction

endclass


module test;

    initial begin
        uvm_reg register;
        automatic Block block = new("block");
        block.lock_model();
        register = block.get_default_map().get_reg_by_offset(0);
        assert(register.get_name() == "a");
    end

endmodule

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions