Skip to content

Make it easier to flop LogicArrays and LogicStructures #587

Description

@mkorbel1

Motivation

The flop function and FlipFlop module flatten structures and arrays to a single packed Logic. If you want to flop an array or a structure, you may often want it to be an array or structure on the way out as well.

Desired solution

For API consistency, we could keep flop and FlipFlop, but update the input and output port creation to use LogicArrays when possible. However, this still would require a cast as LogicArray on the outputs.

Another new API might be a good idea: adding a .flop API onto Logic itself. Then, you could do things like

myLogic.flop(clk, ...) // returns a Logic
myStruct.flop(clk, ...) // returns a LogicStructure
myArray.flop(clk, ...) // returns a LogicArray

This way, the type could be maintained. Under the hood, it can just use the clone method, which already may be properly overridden by users with custom types of structures.

Alternatives considered

Currently, users have to do something like

myArray.clone()..gets(flop(clk, myArray,...));

Additional details

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions