|
| 1 | +# Logic gates library |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +A fast and space-efficient library for handling combinational Boolean circuits composed of the following types of gates: |
| 6 | +- NAND, AND, OR, NOR, XOR, XNOR |
| 7 | + |
| 8 | + |
| 9 | +## Gate implementation details |
| 10 | + |
| 11 | +- A gate has a non-negative integer number of fan-ins (inputs) and one fan-out (output). |
| 12 | +- A gate with no fan-ins always outputs a signal with the value false. |
| 13 | +- For a positive n, the fan-ins of an n-input gate are numbered from 0 to n - 1. |
| 14 | +- A Boolean signal with values false or true can be supplied to the fan-ins of a gate. |
| 15 | +- The fan-out signal from a gate can be connected to multiple fan-ins of other gates. |
| 16 | +- Each fan-in of a gate can have only one signal source connected to it. |
| 17 | + |
| 18 | +## API Reference |
| 19 | + |
| 20 | +You can find the API reference for this library at the following link: [API Reference](link). |
| 21 | + |
| 22 | +## Building and Running |
| 23 | + |
| 24 | +### Prerequisites: |
| 25 | +To build and use this library, you need: |
| 26 | + |
| 27 | +- CMake version 3.12 or higher. |
| 28 | +- A supported compiler, such as GCC or Clang, with support for the C17 standard. |
| 29 | + |
| 30 | +### Compilation |
| 31 | + |
| 32 | +1. Download or clone the repository. |
| 33 | + |
| 34 | +2. Build the library and example program by executing the following commands in the root of the repository: |
| 35 | + |
| 36 | +```bash |
| 37 | +cmake -B build/ |
| 38 | +make -C build/ |
| 39 | +``` |
| 40 | + |
| 41 | +This will create two binaries in `build/` directory: |
| 42 | +- `libgate.so` - the shared library file. |
| 43 | +- `example` - an example program demonstrating the usage of the library. |
| 44 | + |
| 45 | +You can now link `libgate.so` to your own program. |
| 46 | + |
| 47 | +#### Release Build |
| 48 | +For potentially better performance, build in Release mode to enable `-O3` and `-march=native`: |
| 49 | +```bash |
| 50 | +cmake -B build/ -DCMAKE_BUILD_TYPE=Release |
| 51 | +make -C build/ |
| 52 | +``` |
| 53 | + |
| 54 | + |
| 55 | +### Example |
| 56 | +For demonstration purposes, you can refer to and modify the `example.c` file. It showcases a sample usage of this library. |
| 57 | + |
| 58 | +Gate from `example.c`: |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +## License |
| 64 | + |
| 65 | +This project is licensed under the **GNU General Public License v3.0**. |
| 66 | +See [LICENSE](LICENSE.md) for the full terms. |
0 commit comments