hdl.ast: simplify {bit,word}_select with constant offset.
authorwhitequark <whitequark@whitequark.org>
Sat, 26 Oct 2019 00:09:53 +0000 (00:09 +0000)
committerwhitequark <whitequark@whitequark.org>
Sat, 26 Oct 2019 00:09:53 +0000 (00:09 +0000)
commit51269ad4a037f7789a44cf1d1dd3256f447cd619
treef80fd8a450cc34105c4d11eaf707f6dbcb8cf5f8
parent61e6267dafa4e4cde711c91509bd825e6e6839a6
hdl.ast: simplify {bit,word}_select with constant offset.

We don't have any other convenient shortcut for x[off*w:(off+1)*w],
but using word_select to extract a single static range would result
in severe bloat of emitted code through expansion to dead branches.
Recognize and simplify this pattern.
nmigen/hdl/ast.py
nmigen/test/test_hdl_ast.py