Skip to content

Boolean Operations on Fields and Signals #154

Closed
@willy134

Description

@willy134

Looking through the compiler examples and test cases, I never could find an example of the boolean operations.

I was looking for something like this

reg {
    field {
       desc="Write 0x9A to unlock register"
       sw=rw;
       hw=na;
     } unlock[31:16];
    field {
      desc="locked field";
      sw=rw;
      hw=r;
    } locked[7:0];
    locked->swwe = unlock->next == 0x9A || unlock == 0x9A;
}

The hope is that the boolean == and || operations actually result in a boolean value for the swwe signal in this case. I also see use cases where a register is reset when a magic key is written to it (think watchdog timer).

Are there any known examples of these boolean operations? Does my interpretation of the spec make sense? I could create similar things with the external swwe signal, but it would lack the ability to use the next reference.

The error I am seeing when I try this is:
fatal: Left and right operands of expression are not compatible types

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions