def main(): INFO = "test for memory_generator.py" VERSION = "ver.1.0.0" USAGE = "Usage: python memory_generator.py memtype name datawidth addrlen numports" def showVersion(): print(INFO) print(VERSION) print(USAGE) sys.exit() optparser = OptionParser() optparser.add_option("-v","--version",action="store_true",dest="showversion", default=False,help="Show the version") optparser.add_option("-n","--name",dest="name", default="MemoryEmulator",help="Module name, Default=MemoryEmulator") optparser.add_option("--cache_capacity",dest="cache_capacity",type='int', default=4096,help="Default Cache Capacity, Default=4096 (byte)") (options, args) = optparser.parse_args() if options.showversion: showVersion() if len(args) < 5: showVersion() env = Environment(loader=FileSystemLoader(TEMPLATE_DIR)) memorydef = generate(env, args[0], args[1], int(args[2]), int(args[3]), int(args[4]), cache_capacity=options.cache_capacity) print(memorydef)
def create_scratchpad_mux(self, definition): memtype = 'scratchpad_mux' name = definition.name datawidth = definition.datawidth addrlen = definition.addrlen numports = definition.numports rslt = memory_generator.generate(self.env, memtype, name, datawidth=datawidth, addrlen=addrlen, numports=numports) return rslt
def create_offchipmemory(self): memtype = 'offchipmemory' name = self.offchipmemory.name offchip_datawidth = self.offchipmemory.datawidth offchip_addrlen = int(math.ceil(math.log(self.offchipmemory.size, 2))) offchip_numports = self.offchipmemory.numports rslt = memory_generator.generate(self.env, memtype, name, offchip_datawidth=offchip_datawidth, offchip_addrlen=offchip_addrlen, offchip_numports=offchip_numports) return rslt
def create_marshaller(self, definition): memtype = 'marshaller' name = definition.name addrlen = definition.addrlen offchip_datawidth = self.offchipmemory.datawidth linewidth = definition.cache_linewidth rslt = memory_generator.generate(self.env, memtype, name, addrlen=addrlen, linewidth=linewidth, offchip_datawidth=offchip_datawidth) return rslt
def create_addressmapper(self, definition): memtype = 'addressmapper' name = definition.name addrlen = definition.addrlen offchip_datawidth = self.offchipmemory.datawidth offchip_addrlen = self.offchipmemory.addrlen addrmap_start = definition.offset rslt = memory_generator.generate(self.env, memtype, name, addrlen=addrlen, offchip_datawidth=offchip_datawidth, offchip_addrlen=offchip_addrlen, addrmap_start=addrmap_start) return rslt
def main(): INFO = "test for memory_generator.py" VERSION = "ver.1.0.0" USAGE = "Usage: python memory_generator.py memtype name datawidth addrlen numports" def showVersion(): print(INFO) print(VERSION) print(USAGE) sys.exit() optparser = OptionParser() optparser.add_option("-v", "--version", action="store_true", dest="showversion", default=False, help="Show the version") optparser.add_option("-n", "--name", dest="name", default="MemoryEmulator", help="Module name, Default=MemoryEmulator") optparser.add_option("--cache_capacity", dest="cache_capacity", type='int', default=4096, help="Default Cache Capacity, Default=4096 (byte)") (options, args) = optparser.parse_args() if options.showversion: showVersion() if len(args) < 5: showVersion() env = Environment(loader=FileSystemLoader(TEMPLATE_DIR)) memorydef = generate(env, args[0], args[1], int(args[2]), int(args[3]), int(args[4]), cache_capacity=options.cache_capacity) print(memorydef)
def create_cache(self, definition): memtype = 'banked_cache' # 'cache' name = definition.name datawidth = definition.datawidth addrlen = definition.addrlen numports = definition.numports cache_capacity = definition.cache_capacity numways = definition.cache_way linewidth = definition.cache_linewidth offchip_datawidth = self.offchipmemory.datawidth offchip_addrlen = int(math.ceil(math.log(self.offchipmemory.size, 2))) rslt = memory_generator.generate(self.env, memtype, name, datawidth=datawidth, addrlen=addrlen, numports=numports, cache_capacity=cache_capacity, numways=numways, linewidth=linewidth, offchip_datawidth=offchip_datawidth, offchip_addrlen=offchip_addrlen) return rslt