From db231dd7f7e417463f687468e93ebf3f0b89481f Mon Sep 17 00:00:00 2001 From: Lukas Plevac Date: Sat, 16 Nov 2024 20:46:26 +0100 Subject: [PATCH] Simple generate example --- generate_ariths.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 generate_ariths.py diff --git a/generate_ariths.py b/generate_ariths.py new file mode 100644 index 0000000..8a4b0fd --- /dev/null +++ b/generate_ariths.py @@ -0,0 +1,22 @@ +from io import StringIO +import os, sys + +DIR_PATH = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(DIR_PATH, '..')) + +from ariths_gen.core.arithmetic_circuits import GeneralCircuit +from ariths_gen.multi_bit_circuits.adders import UnsignedRippleCarryAdder, UnsignedCarryLookaheadAdder, UnsignedBrentKungAdder, UnsignedCarryIncrementAdder, UnsignedCarrySkipAdder, UnsignedCarrySelectAdder, UnsignedConditionalSumAdder, UnsignedHanCarlsonAdder, UnsignedKnowlesAdder, UnsignedKoggeStoneAdder, UnsignedLadnerFischerAdder, UnsignedPGRippleCarryAdder, UnsignedSklanskyAdder +from ariths_gen.wire_components import Bus + +from ariths_gen.pdk import * +import os + +from ctypes import c_uint8 + +# usage +if __name__ == "__main__": + + for adder in [UnsignedRippleCarryAdder, UnsignedCarryLookaheadAdder, UnsignedBrentKungAdder, UnsignedCarryIncrementAdder, UnsignedCarrySkipAdder, UnsignedCarrySelectAdder, UnsignedConditionalSumAdder, UnsignedHanCarlsonAdder, UnsignedKnowlesAdder, UnsignedKoggeStoneAdder, UnsignedLadnerFischerAdder, UnsignedPGRippleCarryAdder, UnsignedSklanskyAdder]: + maji = adder(Bus("a", 8), Bus("b", 8), prefix="", name=f"uut") + + maji.get_v_code_flat(open(f"{adder.__name__}.v", "w")) \ No newline at end of file