hdl.ast: simplify {bit,word}_select with constant offset.
authorwhitequark <cz@m-labs.hk>
Sat, 26 Oct 2019 00:09:53 +0000 (00:09 +0000)
committerwhitequark <cz@m-labs.hk>
Sat, 26 Oct 2019 00:09:53 +0000 (00:09 +0000)
commit1292cbd87ee3937e8aecc585c605e84d8de1c146
treef80fd8a450cc34105c4d11eaf707f6dbcb8cf5f8
parentd5192113eef852f1324b664e097b1520ad8e3e98
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