- A Logic Circuit Simulation Library in C++





(Topic Guide) Bit operations on bus lines


libLCS provides overloaded operators to facilitate an intuitive way to perform bitwise operations on bus line states. The result of such an operation can be assigned to another lcs::Bus or lcs::BitBuff object or its bit selects. An example is shown below.

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

lcs::BitBuff<> result;
result = (b[0] & b[1]) ^ (b[2] | b[3]) & (b[4] ^ b[0]);

Copyright © 2006, 2007 Siva Chandra