Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
536 changes: 536 additions & 0 deletions examples/RISCV-32-Sail-Validation/list.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-lb.elf
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-lh.elf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-lw.elf
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-or.elf
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-sb.elf
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-sh.elf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-32-Sail-Validation/rv32ui-p-sw.elf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
490 changes: 490 additions & 0 deletions examples/RISCV-64-Sail-Validation/list.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-lb.elf
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-ld.elf
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-lh.elf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-lw.elf
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-or.elf
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-sb.elf
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-sd.elf
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-sh.elf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/RISCV-64-Sail-Validation/rv64ui-p-sw.elf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions src/core/events.mts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const CoreEventTypes = {
ARDUINO_PIN_CHANGED: "arduino-pin-write",
ARDUINO_RESET: "arduino-reset",
ARDUINO_PIN_INTERRUPT: "arduino-pin-interrupt",
VALIDATION_UPDATE: "update-validation",
} as const;

/**
Expand Down
144 changes: 143 additions & 1 deletion src/core/executor/sailSimRV/sailExecutor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,150 @@
import sail64sim from "./wasm/riscv_sim_RV64.js"
import sail32vdsim from "./wasm/riscv_sim_RV32vd.js"
import { vectoren, doubleen } from "../../assembler/sailAssembler/web/CNAssambler.mjs";
import { coreEvents } from "../../events.mts";

export var sailexec;
var programs = [];

async function cargarProgramas32(jsonPath) {

const response = await fetch(jsonPath);
const lista = await response.json();

const programas = await Promise.all(
lista.map(async entry => {

const binResponse = await fetch(entry.url);
const buffer = await binResponse.arrayBuffer();

const programa = {
name: entry.name,
binary: new Uint8Array(buffer)
};

if ("doubleen" in entry) programa.doubleen = entry.doubleen;
if ("vectoren" in entry) programa.vectoren = entry.vectoren;

return programa;
})
);

return programas;
}

async function cargarProgramas64(jsonPath){

const response = await fetch(jsonPath);
const lista = await response.json();

const programas = await Promise.all(
lista.map(async entry => {

const binResponse = await fetch(entry.url);
const buffer = await binResponse.arrayBuffer();

const programa = {
name: entry.name,
binary: new Uint8Array(buffer)
};

return programa;
})
);

return programas;
}

export async function SailTest32(){
// Reset de las variables test
document.app.$data.passed_test = 0;
document.app.$data.failed_test = 0;
document.app.$data.testing = true;
document.app.$data.c_kernel = false;
if (programs.length === 0)
programs = await cargarProgramas32("../../../../examples/RISCV-32-Sail-Validation/list.json");

for (let index = 0; index < programs.length; index++) {

document.app.$data.execution_mode_run = -1;
const element = programs[index];

Check warning on line 72 in src/core/executor/sailSimRV/sailExecutor.mjs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/core/executor/sailSimRV/sailExecutor.mjs#L72

Variable Assigned to Object Injection Sink
let depsLeft = Infinity;
if (element.vectoren && element.doubleen) {
sailexec = await sail32vdsim({
noInitialRun: true,
// print: (t) => console.log('[sim32]', t),
// printErr: (t) => console.warn('[sim32:err]', t),
// onAbort: (t) => console.error("[sim32:abort]", t),
monitorRunDependencies(left) {
depsLeft = left;
console.log("[sim32] deps pending:", left);
},
});
} else {
sailexec = await sail32sim({
noInitialRun: true,
// print: (t) => console.log('[sim32]', t),
// printErr: (t) => console.warn('[sim32:err]', t),
// onAbort: (t) => console.error("[sim32:abort]", t),
monitorRunDependencies(left) {
depsLeft = left;
console.log("[sim32] deps pending:", left);
},
});
}

await new Promise((resolve) => {
const check = () => {
if (depsLeft === 0) resolve();
else setTimeout(check, 100);
};
check();
});
document.app.$data.execution_mode_run = 0;
sailexec.run([element.binary, "--entry-address", "0x80000000", "--cache-pol", "1", "-p", "output.elf"]);
coreEvents.emit("update-validation");


}

document.app.$data.testing = false;

Check warning on line 112 in src/core/executor/sailSimRV/sailExecutor.mjs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/core/executor/sailSimRV/sailExecutor.mjs#L112

Unhandled errors detected in asynchronous function

}
export async function SailTest64(){
var filed_tests = [];
document.app.$data.passed_test = 0;
document.app.$data.failed_test = 0;
document.app.$data.testing = true;
document.app.$data.c_kernel = false;
if (programs.length === 0)
programs = await cargarProgramas64("../../../../examples/RISCV-64-Sail-Validation/list.json");

for (let index = 0; index < programs.length; index++) {

document.app.$data.execution_mode_run = -1;
const element = programs[index];
let depsLeft = Infinity;
sailexec = await sail64sim({
noInitialRun: true,
monitorRunDependencies(left) {
depsLeft = left;
console.log("[sim64] deps pending:", left);
},
});
await new Promise((resolve) => {
const check = () => {
if (depsLeft === 0) resolve();
else setTimeout(check, 100);
};
check();
});
document.app.$data.execution_mode_run = 0;
sailexec.run([element.binary, "--entry-address", "0x80000000", "--cache-pol", "1", "-p", "output.elf"]);
coreEvents.emit("update-validation");
}

document.app.$data.testing = false;
}
export async function SailExecute(binary, flags){
let depsLeft = Infinity;
if (architecture.config.name === "SRV32") {
Expand Down Expand Up @@ -64,7 +207,6 @@
// Once it is initialized, lets run the program

// document.app.$data.execution_mode_run = 0;
console.log(flags);

sailexec.run([binary, ...flags]);

Expand Down
51 changes: 28 additions & 23 deletions src/core/executor/sailSimRV/wasm/riscv_sim_RV32.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var Module = (() => {
var insn_number;

return function (Module) {
document.app.$data.is_breakpoint = instructions[0].Break;
document.app.$data.is_breakpoint = (instructions.length !== 0) ? instructions[0].Break : false;
var pc_sail = crex_findReg_bytag("program_counter");
var pc_min = architecture.memory_layout.text.start;
var pc_max = architecture.memory_layout.text.end;
Expand Down Expand Up @@ -1194,8 +1194,7 @@ var Module = (() => {
console.warn(message);
}

var out = Module["print"] /*|| console.log.bind(console)*/;
// var out = console.log.bind(console);
var out = (document.app.$data.testing === true ) ? console.log.bind(console) : Module["print"];
var err = Module["printErr"] /*|| console.warn.bind(console)*/;

Object.assign(Module, moduleOverrides);
Expand Down Expand Up @@ -7824,27 +7823,33 @@ var Module = (() => {
}
if (keepRuntimeAlive()) {
if (!implicit) {

for (let i = 0; i < instructions.length; i++){
instructions[i]._rowVariant = '';
}
status.run_program = -1; // program finished
if (statusw !== 0){
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: true,
run_disable: true,
stop_disable: false,
});
show_notification("Your program has finished with errors.", "danger");
if (!document.app.$data.testing) {
for (let i = 0; i < instructions.length; i++){
instructions[i]._rowVariant = '';
}
status.run_program = -1; // program finished
if (statusw !== 0){
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: true,
run_disable: true,
stop_disable: false,
});
show_notification("Your program has finished with errors.", "danger");
} else {
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: false,
run_disable: false,
stop_disable: true,
isFinished: true,
});
}
} else {
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: false,
run_disable: false,
stop_disable: true,
isFinished: true,
});
if (statusw === 0)
document.app.$data.passed_test += 1;
else
document.app.$data.failed_test += 1;
}
var msg =
"program exited (with status: " +
Expand Down
Binary file modified src/core/executor/sailSimRV/wasm/riscv_sim_RV32.wasm
Binary file not shown.
51 changes: 29 additions & 22 deletions src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var Module = (() => {
var _scriptName = import.meta.url;
var insn_number;

return async function (moduleArg = {}) {document.app.$data.is_breakpoint = instructions[0].Break;
return async function (moduleArg = {}) {
document.app.$data.is_breakpoint = (instructions.length !== 0) ? instructions[0].Break : false;
var pc_sail = crex_findReg_bytag("program_counter");
var pc_min = architecture.memory_layout.text.start;
var pc_max = architecture.memory_layout.text.end;
Expand Down Expand Up @@ -957,8 +958,7 @@ var Module = (() => {
console.warn(message);
}

var out = Module["print"] /*|| console.log.bind(console)*/;
// var out = console.log.bind(console);
var out = (document.app.$data.testing === true ) ? console.log.bind(console) : Module["print"];
var err = Module["printErr"] /*|| console.warn.bind(console)*/;


Expand Down Expand Up @@ -4290,26 +4290,33 @@ var Module = (() => {
EXITSTATUS = statusw;
checkUnflushedContent();
if (keepRuntimeAlive() && !implicit) {
for (let i = 0; i < instructions.length; i++){
instructions[i]._rowVariant = '';
}
status.run_program = -1; // program finished
if (statusw !== 0){
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: true,
run_disable: true,
stop_disable: false,
});
show_notification("Your program has finished with errors.", "danger");
if (!document.app.$data.testing){
for (let i = 0; i < instructions.length; i++){
instructions[i]._rowVariant = '';
}
status.run_program = -1; // program finished
if (statusw !== 0){
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: true,
run_disable: true,
stop_disable: false,
});
show_notification("Your program has finished with errors.", "danger");
} else {
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: false,
run_disable: false,
stop_disable: true,
isFinished: true,
});
}
} else {
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: false,
run_disable: false,
stop_disable: true,
isFinished: true,
});
if (statusw === 0)
document.app.$data.passed_test += 1;
else
document.app.$data.failed_test += 1;
}
var msg = `program exited (with status: ${statusw}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
readyPromiseReject(msg);
Expand Down
Binary file modified src/core/executor/sailSimRV/wasm/riscv_sim_RV32vd.wasm
Binary file not shown.
50 changes: 28 additions & 22 deletions src/core/executor/sailSimRV/wasm/riscv_sim_RV64.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var Module = (() => {
var insn_number;

return async function (moduleArg = {}) {
document.app.$data.is_breakpoint = instructions[0].Break;
document.app.$data.is_breakpoint = (instructions.length !== 0) ? instructions[0].Break : false;
var pc_sail = crex_findReg_bytag("program_counter");
var pc_min = architecture.memory_layout.text.start;
var pc_max = architecture.memory_layout.text.end;
Expand Down Expand Up @@ -1009,7 +1009,7 @@ var Module = (() => {
}


var out = Module["print"] /*|| console.log.bind(console)*/;
var out = (document.app.$data.testing === true ) ? console.log.bind(console) : Module["print"];
var err = Module["printErr"] /*|| console.error.bind(console)*/;


Expand Down Expand Up @@ -4341,27 +4341,33 @@ var Module = (() => {
EXITSTATUS = statusw;
checkUnflushedContent();
if (keepRuntimeAlive() && !implicit) {

for (let i = 0; i < instructions.length; i++){
instructions[i]._rowVariant = '';
}
status.run_program = -1; // program finished
if (statusw !== 0){
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: true,
run_disable: true,
stop_disable: false,
});
show_notification("Your program has finished with errors.", "danger");
if (!document.app.$data.testing) {
for (let i = 0; i < instructions.length; i++){
instructions[i]._rowVariant = '';
}
status.run_program = -1; // program finished
if (statusw !== 0){
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: true,
run_disable: true,
stop_disable: false,
});
show_notification("Your program has finished with errors.", "danger");
} else {
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: false,
run_disable: false,
stop_disable: true,
isFinished: true,
});
}
} else {
coreEvents.emit("executor-buttons-update", {
reset_disable: false,
instruction_disable: false,
run_disable: false,
stop_disable: true,
isFinished: true,
});
if (statusw === 0)
document.app.$data.passed_test += 1;
else
document.app.$data.failed_test += 1;
}
var msg = `program exited (with status: ${statusw}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
readyPromiseReject(msg);
Expand Down
Binary file modified src/core/executor/sailSimRV/wasm/riscv_sim_RV64.wasm
Binary file not shown.
8 changes: 8 additions & 0 deletions src/web/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,14 @@ export default {
target_port: "",
target_location: "~/creator",
flash_url: "http://localhost:8080",

/* Validation test */
// Stats
passed_test: 0,
failed_test: 0,

// Check testing execution
testing: false,
};
},

Expand Down
Loading
Loading