nmigen icon indicating copy to clipboard operation
nmigen copied to clipboard

Expand semantics of Array from MutableSequence to MutableMapping

Open whitequark opened this issue 6 years ago • 2 comments

An Array is essentially a mux, and there are several equally valid ways to drive a mux. Currently only straight binary is supported. It would be nice to also have one-hot and priority encodings, since all of these are trivially representable directly in RTLIL and Verilog.

One thing to note is that one-hot and priority are one and the same unless parallel_case is used.

whitequark avatar May 12 '19 13:05 whitequark

The most idiomatic way to do this is to make the Array associative, and make sure that initializing it with a list uses consecutive indices. (The indices still all have to be integers; possibly enums?)

whitequark avatar Sep 18 '19 02:09 whitequark

This is a self-contained feature that doesn't have backwards compatibility concerns, so it doesn't have to be in 0.1.

whitequark avatar Oct 12 '19 23:10 whitequark