Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register model support for SET, CLR and INV registers? #78

Open
redxeth opened this issue Jan 16, 2020 · 3 comments
Open

Register model support for SET, CLR and INV registers? #78

redxeth opened this issue Jan 16, 2020 · 3 comments
Labels
enhancement New feature or request feature discussion Discussion on a feature's requirements or implementation

Comments

@redxeth
Copy link
Member

redxeth commented Jan 16, 2020

On many SOCs there are these convenience SET, CLR, INV registers that server to help modify individual bits of another 'real' register. Often times these are clearly defined in the XML (or other source) already but the issue was that in Origen(1) the register don't work as intended.

i.e.

reg.value = 0x00000000
reg_clr.set 0xF0000000    # should set bits 28-31 of reg but doesn't 
                          # and these bits should clear as well.

How do we support these in O2?

@redxeth redxeth added enhancement New feature or request feature discussion Discussion on a feature's requirements or implementation labels Jan 16, 2020
@ginty
Copy link
Member

ginty commented Jan 17, 2020

Not sure about this one, its getting into the realm of modelling the external effects of register changes which is generally beyond the scope of what Origen can do - obviously there's a million and one other ways that writing a given register can cause changes in another register that we don't model.

This could be handled in the application's main write_register method. Where it would be on the lookout for writes to one of these special registers and then update the data value of the 3rd party register as required.

However, we could also make an exception and handle this in Origen if it is viewed as generally useful.
My main question then would be how do you think we should express this linkage in Origen?

IP-XACT has no way to express something like this btw.

@redxeth
Copy link
Member Author

redxeth commented Jan 17, 2020

I get that. Just had direct experience on another project with this and thought would bring it up for discussion. Would like to know @chrisnappi 's thoughts.

@ginty
Copy link
Member

ginty commented Jan 30, 2020

Here's the current reg definition API:

    # This is the reg description
    with Reg("adc_ctrl", 0x0024, size=16):
        # This is the COCO description
        Field("coco", offset=7, access="ro")
        Field("aien", offset=6)
        Field("diff", offset=5)
        Field("adch", offset=0, width=5, reset=0x1F, enums={
            # A simple enum
            "val1": 3,
            # A more complex enum, all fields except for value are optional, it will probably
            # eventually support assigning the description from this comment
            "val2": { "value": 5, "usage": "w", "description": "The value of something"},
        })

How would we expand that to describe this behavioral linkage between registers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature discussion Discussion on a feature's requirements or implementation
Projects
None yet
Development

No branches or pull requests

2 participants