Browse Source

better info in runtime constraint assertion

feature/witness_bin
Jordi Baylina 5 years ago
parent
commit
67a35ee400
No known key found for this signature in database GPG Key ID: 7480C80C1BE43112
2 changed files with 6 additions and 2 deletions
  1. +2
    -0
      src/exec.js
  2. +4
    -2
      src/gencode.js

+ 2
- 0
src/exec.js

@ -1046,6 +1046,8 @@ function execSignalAssign(ctx, ast) {
}
function execConstrain(ctx, ast) {
ast.fileName = ctx.fileName;
ast.filePath = ctx.filePath;
const a = exec(ctx, ast.values[0]);
if (ctx.error) return;
const b = exec(ctx, ast.values[1]);

+ 4
- 2
src/gencode.js

@ -422,11 +422,13 @@ function genConstrain(ctx, ast) {
if (ctx.error) return;
const b = gen(ctx, ast.values[1]);
if (ctx.error) return;
return `ctx.assert(${a}, ${b})`;
const strErr = ast.fileName +": "+ast.first_line;
return `ctx.assert(${a}, ${b}, \"${strErr}\")`;
}
function genSignalAssignConstrain(ctx, ast) {
return genVarAssignement(ctx, ast) + ";\n" + genConstrain(ctx, ast);
// return genVarAssignement(ctx, ast) + ";\n" + genConstrain(ctx, ast);
return genVarAssignement(ctx, ast);
}
function genVarAddAssignement(ctx, ast) {

Loading…
Cancel
Save