From 3adb22e971953a2b65064f3612959a36d84c383a Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 5 Jul 2017 18:51:06 -0400 Subject: [PATCH] Support x in , --- Changes | 2 ++ include/verilated.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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; } }