This was requested by users, the monolithic way in which we generate the RiscV machine is a bit odd.
Our riscv implementation looks like
machine RiscV {
// implementation of riscv architecture
instr ...
instr ...
constraints ...
// entry point
fn main {
// transpiled assembly
}
}
This is awkward because we want to be able to define the hardware once and use it many times. For this, let's allow:
machine RiscV {
// only the implementation
}
#[entry_point(RiscV)]
function main {
}
When compiling:
find the entry point
take the specified machine and inject the main function, failing if it already has one
continue like now
This could also just be treated as some kind of macro, so that the rest of the system doesn't need to change at all.
Along with the import system, it enables:
#[entry_point(std::architectures::RiscV)]
function main {
}
Alternatives:
Introduce some kind of inheritance machine MyProgram extends RiscV and define main there. This seems like too big of a step for something which seems only required for the entry point
Model this as a submachine:
machine MyProgram {
// somehow give a way to flatten the submachine so that its instructions can be used in the context of this machine
RiscV riscv;
function main() {
}
}
This uses the submachine process which should rather be kept to specify aggregation
The general rationale for this change is that the entry point is a special case, and this kind of main injection would not be used anywhere else, so implementing it as a special case makes more sense than introducing concepts which would affect the whole system.
This was requested by users, the monolithic way in which we generate the RiscV machine is a bit odd.
Our riscv implementation looks like
This is awkward because we want to be able to define the hardware once and use it many times. For this, let's allow:
When compiling:
This could also just be treated as some kind of macro, so that the rest of the system doesn't need to change at all.
Along with the import system, it enables:
Alternatives:
machine MyProgram extends RiscV
and definemain
there. This seems like too big of a step for something which seems only required for the entry pointModel this as a submachine:
This uses the submachine process which should rather be kept to specify aggregation
The general rationale for this change is that the entry point is a special case, and this kind of main injection would not be used anywhere else, so implementing it as a special case makes more sense than introducing concepts which would affect the whole system.
cc @georgwiese