UCSBarchlab / PyRTL

A collection of classes providing simple hardware specification, simulation, tracing, and testing suitable for teaching and research. Simplicity, usability, clarity, and extensibility are the overarching goals, rather than performance or optimization.
http://ucsbarchlab.github.io/PyRTL
BSD 3-Clause "New" or "Revised" License
257 stars 78 forks source link

Move and improve list_to_int helper from test_matrix.py to matrix.py file #371

Closed mdko closed 3 years ago

mdko commented 3 years ago

There was a test helper function, matrix_to_int in test_matrix.py that converts Python lists of lists into an int. Since this is useful outside of testing (i.e. in Simulation), I moved it to matrix.py, renamed it, and added some more functionality (i.e. making sure it handles negative elements (converting to two's complement) and checking for a bad number of bits).