mortbopet / VSRTL

Visual Simulation of Register Transfer Logic
MIT License
87 stars 17 forks source link

Implement comparison operators for class Port #42

Open mortbopet opened 4 years ago

mortbopet commented 4 years ago

It is annoying and verbose to type eg.:

INPUTPORT_W(acc, 32);
...
return acc.value<VSRTL_VT_S>() == 0;

Comparison with integer literals is fairly safe, and should be implemented as an operator, so we can do:

return acc == 0;