import numpy as np import platform import dsim def test05(a): a_len = 10 for i in range(0, a_len): a[i] = 2 * a[i] return a if platform.system() == 'Linux': hw_lib_path = "./hardware/chisel/build/libhw.so" elif platform.system() == 'Darwin': hw_lib_path = "./hardware/chisel/build/libhw.dylib" val_a = list(range(1, 11)) print(val_a) a_s = dsim.DArray(val_a, dsim.DArray.DType.DWord) events = dsim.sim(ptrs = [a_s], vars= [], numRets=1, numEvents=1, hwlib = hw_lib_path) print("Cycle: " + str(events[0])) print("Output array:\n\t") print(a_s.getData()) print(test05(val_a))
import numpy as np import platform import dsim Type = dsim.DArray.DType a = np.array([1, 2, 3, 4, 5]) b = np.array([0, 0, 0, 0, 0]) a_s = dsim.DArray(a, Type.DWord) b_s = dsim.DArray(b, Type.DWord) if platform.system() == 'Linux': hw_lib_path = "./hardware/chisel/build/libhw.so" elif platform.system() == 'Darwin': hw_lib_path = "./hardware/chisel/build/libhw.dylib" events = dsim.sim(ptrs=[a_s, b_s], vars=[5], numRets=1, numEvents=1, hwlib=hw_lib_path) # print("Cycle: " + str(cycle)) print("Cycle: " + str(events[0])) print(a_s.getData()) print(b_s.getData())
import numpy as np import dsim a = np.array([0, 1, 2, 3, 4]) b = np.array([0, 1, 2, 3, 4]) c = np.array([0, 0, 0, 0, 0]) a_s = dsim.DArray(a) b_s = dsim.DArray(b) c_s = dsim.DArray(c) hw_lib_path = "./hardware/chisel/build/libhw.so" cycle = dsim.sim(ptrs=[a_s, b_s, c_s], vars=[5, 5], hwlib=hw_lib_path) print("Cycle: " + str(cycle)) print(a_s.getData()) print(b_s.getData()) print(c_s.getData())
import numpy as np import platform import dsim a = np.array([1, 2, 3, 4, 5]) a_s = dsim.DArray(a) if platform.system() == 'Linux': hw_lib_path = "./hardware/chisel/build/libhw.so" elif platform.system() == 'Darwin': hw_lib_path = "./hardware/chisel/build/libhw.dylib" cycle = dsim.sim(ptrs = [a_s], vars= [5], hwlib = hw_lib_path) print("Cycle: " + str(cycle)) print(a_s.getData())