-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stdout formating changes for messages. clean-up. nearly ready (ready?…
…) for a pull-request?
- Loading branch information
1 parent
260e497
commit 516c906
Showing
5 changed files
with
49 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// ============================================================================ | ||
// Filename: rv_cfg_func.c | ||
// | ||
// Description: Functions to be called by Sail to get values from a yaml file. | ||
// Description: Functions to be called by Sail and C to get values from a yaml file. | ||
// | ||
// Author(s): Bill McSpadden ([email protected]) | ||
// | ||
|
@@ -71,37 +71,40 @@ rv_cfg_c_configure(void) | |
rv_enable_dirty_update = rv_cfg_c_ext_enable(RV_ISA, "Ssptead"); //TODO: Use this, .... | ||
//rv_enable_dirty_update = rv_cfg_c_bool_c("/hart0/pte_dirty_update_enable"); // .... not this | ||
|
||
rv_enable_misaligned = rv_cfg_c_bool("/hart0/hw_data_misaligned_support"); | ||
rv_enable_misaligned = rv_cfg_c_bool("/hart0/hw_data_misaligned_support"); | ||
|
||
rv_enable_pmp = ( | ||
(rv_cfg_c_bool("/hart0/pmpaddr0/rv32/accessible") ) || | ||
(rv_cfg_c_bool("/hart0/pmpaddr0/rv64/accessible") ) | ||
) ; | ||
rv_enable_pmp = ( | ||
(rv_cfg_c_bool("/hart0/pmpaddr0/rv32/accessible") ) || | ||
(rv_cfg_c_bool("/hart0/pmpaddr0/rv64/accessible") ) | ||
) ; | ||
|
||
rv_ram_size = rv_cfg_c_int("/ram_size") << 20; // Convert to MBs | ||
rv_reset_address = rv_cfg_c_int("/reset/address"); | ||
rv_ram_size = rv_cfg_c_int("/ram_size") << 20; // Convert to MBs | ||
rv_reset_address = rv_cfg_c_int("/reset/address"); | ||
|
||
rv_enable_writable_misa = rv_cfg_c_path_exists("/hart0/misa/rv32/extensions/type/warl"); | ||
rv_enable_writable_misa = rv_cfg_c_path_exists("/hart0/misa/rv32/extensions/type/warl"); | ||
rv_mtval_has_illegal_inst_bits = rv_cfg_c_bool("/hart0/mtval/has_illegal_inst_bits"); | ||
|
||
// ==================================================================== | ||
// Print out the configuration that you just pulled out from the | ||
// RISCV-Config files. Print it out in terms of the Golden Model | ||
// variables that are used in Sail. | ||
//#define CFG_STRING_FMT "%-32s" | ||
#define CFG_STRING_FMT "%-48s" | ||
// printf("%s: '%s'\n", "RV_ISA: ", RV_ISA); | ||
// printf("%-48s '%s'\n", "RV_ISA: ", RV_ISA); | ||
printf(CFG_STRING_FMT "'%s'\n", "RV_ISA: ", RV_ISA); | ||
printf(CFG_STRING_FMT "%s\n", "C ext support (rv_enable_rvc): " , rv_enable_rvc ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "F/D ext support (rv_enable_fdext):", rv_enable_fdext ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "N ext support (rv_enable_next): ", rv_enable_next ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "Zfinx ext support (rv_enable_zfinx): ", rv_enable_zfinx ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "enable misaligned support (rv_enable_misaligned): ", rv_enable_misaligned ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "enable pmp support (rv_enable_pmp): ", rv_enable_pmp ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%ld MB\n", "ram size (rv_ram_size): ", rv_ram_size >> 20); | ||
printf(CFG_STRING_FMT "0x%lx\n", "reset address (rv_reset_address, zPC): ", rv_reset_address); | ||
printf(CFG_STRING_FMT "%s\n", "PTE dirty update enable (rv_enable_dirty_update): ", rv_enable_dirty_update ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "writable misa (rv_enable_writable_misa): ", rv_enable_writable_misa ? "true" : "false"); | ||
#define CFG_STRING_FMT "%-56s" | ||
printf("=================================================================================\n"); | ||
printf("Start: RISC-V Golden Model configuration values.....\n"); | ||
printf(CFG_STRING_FMT "'%s'\n", "RV_ISA: ", RV_ISA); | ||
printf(CFG_STRING_FMT "%s\n", "C ext support (rv_enable_rvc): " , rv_enable_rvc ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "F/D ext support (rv_enable_fdext):", rv_enable_fdext ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "N ext support (rv_enable_next): ", rv_enable_next ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "Zfinx ext support (rv_enable_zfinx): ", rv_enable_zfinx ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "enable misaligned support (rv_enable_misaligned): ", rv_enable_misaligned ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "enable pmp support (rv_enable_pmp): ", rv_enable_pmp ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%ld MB\n", "ram size (rv_ram_size): ", rv_ram_size >> 20); | ||
printf(CFG_STRING_FMT "0x%lx\n", "reset address (rv_reset_address, zPC): ", rv_reset_address); | ||
printf(CFG_STRING_FMT "%s\n", "PTE dirty update enable (rv_enable_dirty_update): ", rv_enable_dirty_update ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "writable misa (rv_enable_writable_misa): ", rv_enable_writable_misa ? "true" : "false"); | ||
printf(CFG_STRING_FMT "%s\n", "mtval: illegal inst (rv_mtval_has_illegal_inst_bits): ", rv_mtval_has_illegal_inst_bits ? "true" : "false"); | ||
printf("End: RISC-V Golden Model configuration values.....\n"); | ||
printf("=================================================================================\n"); | ||
|
||
// ==================================== | ||
// Error checking of configuration. | ||
|
@@ -249,9 +252,7 @@ rv_cfg_c_ext_enable(char * isa_str, char * ext_pattern) | |
match_data, /* block for storing the result */ | ||
NULL); /* use default match context */ | ||
|
||
// printf("%s, %d: rc: %d\n", __FILE__, __LINE__, rc); | ||
|
||
if ((rc == 0) || (rc == -1)) | ||
if ((rc == 0) || (rc == -1)) // Does not match | ||
{ | ||
return(0); | ||
} | ||
|
@@ -265,8 +266,6 @@ rv_cfg_c_ext_enable(char * isa_str, char * ext_pattern) | |
__FILE__, __LINE__, rc, ext_pattern, isa_str); | ||
exit(1); | ||
} | ||
|
||
|
||
} | ||
|
||
// ============================================================================ | ||
|
@@ -352,8 +351,6 @@ rv_cfg_c_int(char * key_str) | |
if (count == 1) | ||
{ | ||
free(tmp_str); | ||
printf("%s, %d: value found, 0x%x, in %s\n", __FILE__, __LINE__, yaml_val_int, rv_cfg_enum2doc_a[i].filename); | ||
//fy_emit_document_to_fp(fyd, FYECF_DEFAULT | FYECF_SORT_KEYS, stdout); | ||
return(yaml_val_int); | ||
} | ||
free(tmp_str); | ||
|
@@ -399,11 +396,8 @@ rv_cfg_c_string(char * key_str) | |
if (count == 1) | ||
{ | ||
free(tmp_str); | ||
printf("%s, %d: value found, '%s', in %s\n", __FILE__, __LINE__, yaml_val_string, rv_cfg_enum2doc_a[i].filename); | ||
ret_str_ptr = malloc(strlen(yaml_val_string)); // TODO: where should this be freed? | ||
strcpy(ret_str_ptr, yaml_val_string); | ||
// ret_str_ptr = yaml_val_string; | ||
//fy_emit_document_to_fp(fyd, FYECF_DEFAULT | FYECF_SORT_KEYS, stdout); | ||
return(ret_str_ptr); | ||
} | ||
free(tmp_str); | ||
|
@@ -449,8 +443,7 @@ rv_cfg_s_string(sail_string s, char * yaml_key_str) | |
return(1); | ||
} | ||
|
||
|
||
|
||
// ============================================================================ | ||
unit | ||
rv_cfg_s_dump_yaml(char *yaml_filename) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters