tum-ei-eda / M2-ISA-R

CoreDSL2 Parser with backend to generate simulation code for the ETISS instruction set simulator
https://tum-ei-eda.github.io/M2-ISA-R/
Apache License 2.0
5 stars 6 forks source link

Fix static arguments in function calls #4

Closed fpedd closed 3 years ago

fpedd commented 3 years ago

Static arguments in function calls will now be correctly handled.

This behaviour code for example:

val _vtype[XLEN] <= CSR[VTYPE_ADDR];
val _vstart[XLEN] <= CSR[VSTART_ADDR];
val _vl[XLEN] <= CSR[VL_ADDR];
val _vlen[XLEN] <= CSR[VLENB_ADDR]*8;

val ret[XLEN] <= fdispatch_vadd_vv(V, _vtype, vm, vd, vs1, vs2, _vstart, _vlen, _vl);

would have been converted to this code:

...
partInit.code() += "etiss_uint32 ret = vadd_vv(((RISCV*)cpu)->V, _vtype, vm, vd, vs1, vs2, _vstart, _vlen, _vl);\n";

which would have caused an Error, as vm, vd and so on are not defined in the code that gets handed to the JIT. This statement now gets converted to:

...
partInit.code() += "etiss_uint32 ret = vadd_vv(((RISCV*)cpu)->V, _vtype, " + std::to_string(vm) + ", " + std::to_string(vd) + ", " + std::to_string(vs1) + ", " + std::to_string(vs2) + ", _vstart, _vlen, _vl);\n";