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
Motivation
The
flopfunction andFlipFlopmodule flatten structures and arrays to a single packedLogic. 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
flopandFlipFlop, but update the input and output port creation to useLogicArrays when possible. However, this still would require a castas LogicArrayon the outputs.Another new API might be a good idea: adding a
.flopAPI ontoLogicitself. Then, you could do things likeThis way, the type could be maintained. Under the hood, it can just use the
clonemethod, which already may be properly overridden by users with custom types of structures.Alternatives considered
Currently, users have to do something like
Additional details
No response