- A Logic Circuit Simulation Library in C++





(Topic Guide) Bit operations on bus lines


The lcs::LineState enumerations are provided with overloaded bitwise logical operators. These operators, together with the overloaded operator[] of lcs::InputBus facilitate bitwise logic operations on the bus line states using a very simple syntax. The code snippet below illustrates this. See the API reference of the enumeration lcs::LineState for more information:

lcs::Bus<5> bus(21); // The bus lines have been initialised to a binary equivalent of the decimal
                     // integer 21.

lcs::LineState result = (bus[0] & bus[1]) ^ (bus[2] | bus[3]) & (bus[4] ^ bus[0]);

Copyright © 2006, 2007 Siva Chandra