pyvsc icon indicating copy to clipboard operation
pyvsc copied to clipboard

incorrect UCIS coverage report format ?

Open rbarzic opened this issue 2 years ago • 2 comments

I've started evaluating pyvsc as a replacement for cocotb-coverage in our IC design team and while I was able to generate a successful coverage report as text file, the corresponding UCIS xml file was not displayed correctly by the fc4sc tools/gui/index.html web viewer

text report : test_gen_pyvsc.simple_test.txt

xml UCIS report : test_gen_pyvsc.simple_test.ucis.xml.gz

How the UCIS report looks like with the WEB reader image

This is how a similar report generated using cocotb-coverage (+ UCIS generation patch) looks like: image

the corresponding XML file from cocotb-coverage test_gen.simple_test.ucis.xml.gz

The code used to create the coverage bins is the following:

@vsc.covergroup
class APBSlaveCoverGroup:
    def __init__(self):
        self.with_sample(dict(addr=vsc.uint16_t(), write=vsc.bit_t()))
        "Create a instance of APBSlaveCoverGroup"
        self.add_cp = vsc.coverpoint(
            self.addr,
            bins={k: vsc.bin(v) for (k, v) in params.reg_dict_ext.items()},
        )
        self.type_cp = vsc.coverpoint(
            self.write,
            bins={
                "read": vsc.bin(0),
                "write": vsc.bin(1),
            },
        )

with params.reg_dict_ext declared as followed

reg_dict_ext = {'dout': 0, 'din': 12, 'dir': 16, 'ie': 28, 'pe': 32, 'pdir': 36, 'sr': 40, 'ds0': 52, 'ds1': 56, 'schmitt': 60, 'function*0': 64, 'function*1': 68, 'function*2': 72, 'function*3': 76, 'function*4': 80, 'function*5': 84, 'function*6': 88, 'function*7': 92, 'function*8': 96, 'function*9': 100, 'function*10': 104, 'function*11': 108, 'function*12': 112, 'function*13': 116, 'function*14': 120, 'function*15': 124, 'function*16': 128, 'function*17': 132, 'function*18': 136, 'function*19': 140, 'function*20': 144, 'function*21': 148, 'function*22': 152, 'function*23': 156, 'function*24': 160, 'function*25': 164, 'function*26': 168, 'function*27': 172, 'function*28': 176, 'function*29': 180, 'function*30': 184, 'function*31': 188, 'doutset': 4, 'doutclear': 8, 'dirset': 20, 'dirclear': 24, 'srset': 44, 'srclear': 48}

the coverage group is about monitoring which register has been accessed on a APB slave. addr represent the address and a bus and write represent the read/write selection signal. The reg_dict_ext represents the register mapping on the bus (the key is the register name, the value is the address on the bus)

Code used for generating the report:

    txt_coverage = vsc.get_coverage_report(details=True)
    if log:
        dut._log.info("Coverage Report :\n" + txt_coverage)
    # export
    vsc.write_coverage_db(filename=f"{output_dir}/{calling_module}.{test_name}.ucis.xml")
    with open(f"{output_dir}/{calling_module}.{test_name}.rpt",'w')  as f:
        f.write(txt_coverage)

rbarzic avatar Nov 09 '21 08:11 rbarzic

But apparently the UCIS file is opened correctly in pyucis-viewer (that I have just discovered BTW)

image

rbarzic avatar Nov 09 '21 09:11 rbarzic

Hi @rbarzic, Unfortunately, I don't have a full set of answers on this one. When I first started work on pyUCIS, I looked at the XML generated by fc4sc and found that it didn't validate against the published UCIS XML schema. At the time, I didn't investigate further. My understanding is that some pyVSC/pyUCIS users are taking the generated XML into commercial EDA coverage-analysis flows, which gives some weight to the view that the pyUCIS XML might be correct (subjective, of course, since I'm unable to work with that specific commercial EDA flow myself...). What can you tell me about your intended use model and tool flow? It sounds like you might be using the fc4sc viewer, since you're currently using cocotb-coverage. It might be possible to support, at minimum, writing the XML format accepted by the viewer. Depending on your simulator toolchain, there might be other options for getting pyVSC coverage data into the coverage reporting tools there.

mballance avatar Nov 09 '21 15:11 mballance