mirror of
https://github.com/verilator/verilator.git
synced 2026-09-03 16:28:53 +02:00
@@ -56,6 +56,7 @@
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
@@ -916,6 +917,20 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'p': { // 'x' but parameter is string
|
||||
const int lbits = va_arg(ap, int);
|
||||
const std::string* const cstr = va_arg(ap, const std::string*);
|
||||
std::ostringstream oss;
|
||||
for (unsigned char c : *cstr) { oss << std::hex << static_cast<int>(c); }
|
||||
std::string hex_str = oss.str();
|
||||
if (width > 0 && widthSet) {
|
||||
hex_str = hex_str.size() > width
|
||||
? hex_str.substr(0, width)
|
||||
: std::string(width - hex_str.size(), '0') + hex_str;
|
||||
output += hex_str;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// Deal with all read-and-print somethings
|
||||
const int lbits = va_arg(ap, int);
|
||||
|
||||
Reference in New Issue
Block a user