Skip to content

Two fields controlling one bit #142

Answered by amykyta3
mpriestleyidex asked this question in Q&A
Discussion options

You must be logged in to vote

Sounds what you're looking for is an alias register: (PeakRDL-regblock doesn't support aliases yet, but i hope to add it soon)

reg my_register {
    field {
        sw=rw;
    } f[31:0] = 0;
};

// Primary instance of the register
// This has normal read/write access
my_register my_reg_rw @ 0x00;

// Alias of "my_reg_rw", but it has access policy write-1-clear
alias my_reg_rw my_register alias_w1c @ 0x04;
alias_w1c.f->onwrite = woclr;

// Alias of "my_reg_rw", but it has access policy write-1-set
alias my_reg_rw my_register alias_w1s @ 0x08;
alias_w1s.f->onwrite = woset;

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@amykyta3
Comment options

@craigc40
Comment options

@amykyta3
Comment options

@craigc40
Comment options

@amykyta3
Comment options

Answer selected by mpriestleyidex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants