Conventional computer architecture is problematic for memory-intensive applications due to the need to read and write from the memory, where the bottleneck is the data transfer and not the processing itself. To improve the performance and reduce the power of these applications, special purpose accelerators are usually used, although the need to transfer the data is still the major limitation. The presented invention is a novel method for implementing logic gates using only memristors. The topology of the Memristor Aided Logic (MAGIC) gates allows it to be fabricated within the memory, allowing for the performance of logic within the memory, without the need to have a different circuitry or to transfer the storage mechanism, ultimately reducing bandwidth, reducing power, improving parallelism, and improving the performance of computing systems.