use error code in read_arch command

This commit is contained in:
tangxifan 2020-05-14 20:02:42 -06:00
parent e9ceedb01b
commit f52b5d5b4c
3 changed files with 7 additions and 6 deletions

View File

@ -447,7 +447,7 @@ size_t check_circuit_library_ports(const CircuitLibrary& circuit_lib) {
* 9. LUT must have at least an input, an output and a SRAM ports
* 10. We must have default circuit models for these types: MUX, channel wires and wires
***********************************************************************/
void check_circuit_library(const CircuitLibrary& circuit_lib) {
bool check_circuit_library(const CircuitLibrary& circuit_lib) {
size_t num_err = 0;
vtr::ScopedStartFinishTimer timer("Check circuit library");
@ -545,10 +545,10 @@ void check_circuit_library(const CircuitLibrary& circuit_lib) {
if (0 < num_err) {
VTR_LOG("Finished checking circuit library with %d errors!\n",
num_err);
exit(1);
return false;
}
VTR_LOG("Checking circuit library passed.\n");
return;
return true;
}

View File

@ -43,6 +43,6 @@ size_t check_sram_circuit_model_ports(const CircuitLibrary& circuit_lib,
const CircuitModelId& circuit_model,
const bool& check_blwl);
void check_circuit_library(const CircuitLibrary& circuit_lib);
bool check_circuit_library(const CircuitLibrary& circuit_lib);
#endif

View File

@ -46,9 +46,10 @@ int read_arch(OpenfpgaContext& openfpga_context,
* 2. Technology library (TODO)
* 3. Simulation settings (TODO)
*/
check_circuit_library(openfpga_context.arch().circuit_lib);
if (false == check_circuit_library(openfpga_context.arch().circuit_lib)) {
return CMD_EXEC_FATAL_ERROR;
}
/* TODO: should identify the error code from internal function execution */
return CMD_EXEC_SUCCESS;
}