diff --git a/Changes b/Changes index 17b91b7e3..d0f5a018f 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks! * Verilator 3.907 devel +**** Support x in $readmem, bug1180. [Arthur Kahlich] + * Verilator 3.906 2017-06-22 diff --git a/include/verilated.cpp b/include/verilated.cpp index 1f0f1655c..fb451fd21 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -1038,9 +1038,9 @@ void VL_READMEM_N(bool hex, int width, int depth, int array_lsb, int fnwords, else if (c=='_') {} else if (c=='@') { reading_addr = true; innum=false; needinc=false; } // Check for hex or binary digits as file format requests - else if (isxdigit(c)) { + else if (isxdigit(c) || (!reading_addr && (c=='x' || c=='X'))) { c = tolower(c); - int value = (c >= 'a' ? (c-'a'+10) : (c-'0')); + int value = (c >= 'a' ? (c=='x' ? VL_RAND_RESET_I(4) : (c-'a'+10)) : (c-'0')); if (!innum) { // Prep for next number if (needinc) { addr++; needinc=false; } }