1

我有一个寄存器读取序列,如下所示:

extend vr_ad_sequence_kind: [READ_REG];
extend READ_REG vr_ad_sequence {
    // register to read
    reg_kind : vr_ad_reg_kind;
    !reg : vr_ad_reg;

    // more fields no longer shown here

    body() @driver.clock is {
        var reg_item : vr_ad_reg; // reg_item gets a value from a
                                  // method that returns the correct
                                  // register instance from the addr_map,
                                  // which I no longer want to show here

        reg = new vr_ad_reg with { .kind = reg_kind; };      
        read_reg { .static_item == reg_item; } reg;  
    };   
};

现在,我有一个执行上述 vr_ad_sequence 的虚拟序列:

extend MAIN MAIN_TEST sample_vseq {
    !reg_read   : READ_REG vr_ad_sequence;

    body() @driver.clock is first {
        do reg_read keeping {
            .driver == driver.reg_driver;
            .reg_kind == MY_REGISTER;
        };

        // how to get the value of MY_REGISTER.MY_FIELD from
        // the reg_read sequence above?
    };
};

我的主要目标是读取特定寄存器位字段的值,即上面示例中的 MY_FIELD。有没有办法在不修改原始内容的情况下做到这一点READ_REG vr_ad_sequence?如果无法帮助,我如何READ_REG vr_ad_sequence将读取的值返回给调用sample_vseq

首先十分感谢。

4

1 回答 1

1

要在读取后获取寄存器值,您首先必须确保在总线上完成读取。因此,要么你的 BFM 被阻塞(通常不是),要么你在序列中添加一个标志,告诉你是否收到了响应(这可以从 BFM/驱动程序中设置)。接下来,您可以从 vr_ad_map 实例中获取值。例如

body() @driver.clock is first {
    do reg_read keeping {
        .driver == driver.reg_driver;
        .reg_kind == MY_REGISTER;
    };
    // Wait for read response
    sync true(reg_read != NULL and reg_read.done);
    // Access shadow register through pointer to vr_ad_map instance
    print addr_map.get_register_by_kind(MY_REGISTER).as_a(MY_REGISTER vr_ad_reg).MY_FIELD;
};

(我现在无法检查语法)

于 2016-12-13T11:23:22.777 回答