Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@wire_struct and wire_matrix helps with naming WireVector slices. Exa…
…mple: @wire_struct class Byte: high: 4 # high is the four most significant bits. low: 4 # low is the four least significant bits. This Byte @wire_struct can be instantiated two ways, by providing a value for each component: byte = Byte(high=0xA, low=0xB) or by providing a value for the entire Byte: byte = Byte(Byte=0xAB) After construction, 'byte' is a WireVector representing the entire Byte (all 8 wires), 'byte.high' is a WireVector representing the four most significant bits, and 'byte.low' is a WireVector representing the four least significant bits. wire_matrix is similar to @wire_struct, except that the slices are numbered instead of named, and all slices must share the same type: # Four slices, each slice has bitwidth 8. Word = wire_matrix(component_schema=8, size=4) @wire_struct and wire_matrix can be composed arbitrarily, so you can have a two-dimensional array of Bytes for example. @wire_struct and wire_matrix have additional features. See the documentation for details.
- Loading branch information