pymtl / pymtl3

Pymtl 3 (Mamba), an open-source Python-based hardware generation, simulation, and verification framework
BSD 3-Clause "New" or "Revised" License
388 stars 46 forks source link

connect_bits2bitstruct #152

Closed yo96 closed 4 years ago

yo96 commented 4 years ago

Very small PR that adds connect_bits2bitstruct in stdlib and a get_type API for connectables.

codecov[bot] commented 4 years ago

Codecov Report

Merging #152 into master will increase coverage by 0.02%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
+ Coverage   90.42%   90.45%   +0.02%     
==========================================
  Files         277      279       +2     
  Lines       23745    23846     +101     
==========================================
+ Hits        21472    21570      +98     
- Misses       2273     2276       +3     
Impacted Files Coverage Δ
pymtl3/stdlib/connects/connect_bits2bitstruct.py 93.75% <0.00%> (ø)
...tl3/stdlib/connects/connect_bits2bitstruct_test.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 13c53cf...35f5840. Read the comment docs.

jsn1993 commented 4 years ago

@ptpan can this actually help simplify verilog import?

yo96 commented 4 years ago

@jsn1993 Another issue I'd like to discuss is whether we want to check the bitwidth before we do the connect? If so that means we need to call get_nbits on the bitstruct and as a result we traverse the tree twice. I was wondering if there is a way to avoid the repetitive tree traversal.

yo96 commented 4 years ago

@jsn1993 Another issue I'd like to discuss is whether we want to check the bitwidth before we do the connect? If so that means we need to call get_nbits on the bitstruct and as a result we traverse the tree twice. I was wondering if there is a way to avoid the repetitive tree traversal.

whatever. I think I'm over optimizing things.