path = smt.get_path(topmod, name) if not smt.net_exists(topmod, path): match = re.match(r"(.*)\[(\d+)\]$", path[-1]) if match: path[-1] = match.group(1) addr = int(match.group(2)) if not match or not smt.mem_exists(topmod, path): print_msg( "Ignoring init value for unknown net: %s" % (name)) continue meminfo = smt.mem_info(topmod, path) smtexpr = "(select [%s] #b%s)" % ( ".".join(path), bin(addr)[2:].zfill(meminfo[0])) width = meminfo[1] else: smtexpr = "[%s]" % name width = smt.net_width(topmod, path) if width == 1: assert bitidx == 0 smtexpr = "(= %s %s)" % (smtexpr, "true" if value else "false") else: smtexpr = "(= ((_ extract %d %d) %s) #b%d)" % ( bitidx, bitidx, smtexpr, value)
name = init_map[i][0] bitidx = init_map[i][1] path = smt.get_path(topmod, name) if not smt.net_exists(topmod, path): match = re.match(r"(.*)\[(\d+)\]$", path[-1]) if match: path[-1] = match.group(1) addr = int(match.group(2)) if not match or not smt.mem_exists(topmod, path): print_msg("Ignoring init value for unknown net: %s" % (name)) continue meminfo = smt.mem_info(topmod, path) smtexpr = "(select [%s] #b%s)" % (".".join(path), bin(addr)[2:].zfill(meminfo[0])) width = meminfo[1] else: smtexpr = "[%s]" % name width = smt.net_width(topmod, path) if width == 1: assert bitidx == 0 smtexpr = "(= %s %s)" % (smtexpr, "true" if value else "false") else: smtexpr = "(= ((_ extract %d %d) %s) #b%d)" % (bitidx, bitidx, smtexpr, value) constr_assumes[0].append((cexfile, smtexpr))