Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sum-of-product types: unused bits now "don't-care"
Sum-of-product types include common types like Maybe and Either. The representations of values of such types often have bit positions that are unused in some cases. For example, the type 'Maybe (Unsigned 8)' is represented as a 9-bit type, with a 1-bit "discriminator" that is set for Just and clear for Nothing, and an 8-bit 'Unsigned 8' payload. In the 'Nothing' case, the 8 bits of payload are unused. Previously, these unused bits were explicitly initialized to zero. This isn't wrong, but it is overly conservative, and effectively instructs the synthesis tool to put work into ensuring the value of bits that will never be used. This commit switches the representation of bits to use each backend language's "don't-care" or "unknown" representation, giving the synthesis tool more freedom and (in my tests) producing better results. Fixes #212
- Loading branch information