use of com.dat3m.dartagnan.program.memory.Memory in project Dat3M by hernanponcedeleon.
the class ProgramEncoder method encodeMemory.
// Assigns each Address a fixed memory address.
public BooleanFormula encodeMemory(SolverContext ctx) {
checkInitialized();
logger.info("Encoding fixed memory");
Memory memory = program.getMemory();
FormulaManager fmgr = ctx.getFormulaManager();
BooleanFormula[] addrExprs;
if (ARCH_PRECISION > -1) {
BitvectorFormulaManager bvmgr = fmgr.getBitvectorFormulaManager();
addrExprs = memory.getObjects().stream().map(addr -> bvmgr.equal((BitvectorFormula) addr.toIntFormula(ctx), bvmgr.makeBitvector(ARCH_PRECISION, addr.getValue().intValue()))).toArray(BooleanFormula[]::new);
} else {
IntegerFormulaManager imgr = fmgr.getIntegerFormulaManager();
addrExprs = memory.getObjects().stream().map(addr -> imgr.equal((IntegerFormula) addr.toIntFormula(ctx), imgr.makeNumber(addr.getValue().intValue()))).toArray(BooleanFormula[]::new);
}
return fmgr.getBooleanFormulaManager().and(addrExprs);
}
Aggregations