aboutsummaryrefslogtreecommitdiff
path: root/fesvr
diff options
context:
space:
mode:
authorNeel Gala <neelgala@gmail.com>2020-10-16 09:55:59 +0530
committerGitHub <noreply@github.com>2020-10-15 21:25:59 -0700
commit036aacbeb276be794f7a3ba89f5da3c5b2f8eb9f (patch)
tree1d8ab1eb55c1778a6e7767b7f772e2c8fcb64af5 /fesvr
parente4419aa79a3c999e85610616d6e85847b08f7e19 (diff)
downloadriscv-isa-sim-036aacbeb276be794f7a3ba89f5da3c5b2f8eb9f.zip
riscv-isa-sim-036aacbeb276be794f7a3ba89f5da3c5b2f8eb9f.tar.gz
riscv-isa-sim-036aacbeb276be794f7a3ba89f5da3c5b2f8eb9f.tar.bz2
reduce sig_len constraint to 4 bytes (#569)
* reduce sig_len constraint to 4 bytes Spike currently asserts that the signature length should always be a multiple of 16-bytes. However, the compliance suite has agreed to upon the signature being a multiple ot 4-bytes. This prevents some of the tests to run on spike since it fails the assertion. The proposed change fixes this issue and reduces the assertion to 4 bytes. * Added size argument to htif arguments and zero padding for signature output. Defaultline size-16. * Modified type of line_size to unsigned. * Renamed size to granularity. * Rename granularity to signature-granularity. Co-authored-by: dracarys99 <spawan1999@gmail.com>
Diffstat (limited to 'fesvr')
-rw-r--r--fesvr/htif.cc22
-rw-r--r--fesvr/htif.h4
2 files changed, 20 insertions, 6 deletions
diff --git a/fesvr/htif.cc b/fesvr/htif.cc
index f828494..c989cd1 100644
--- a/fesvr/htif.cc
+++ b/fesvr/htif.cc
@@ -64,7 +64,8 @@ htif_t::htif_t(const std::vector<std::string>& args) : htif_t()
for (unsigned int i = 0; i < args.size(); i++) {
argv[i+1] = (char *) args[i].c_str();
}
-
+ //Set line size as 16 by default.
+ line_size = 16;
parse_arguments(argc, argv);
register_devices();
}
@@ -174,12 +175,13 @@ void htif_t::stop()
assert(sigs && "can't open signature file!");
sigs << std::setfill('0') << std::hex;
- const addr_t incr = 16;
- assert(sig_len % incr == 0);
- for (addr_t i = 0; i < sig_len; i += incr)
+ for (addr_t i = 0; i < sig_len; i += line_size)
{
- for (addr_t j = incr; j > 0; j--)
- sigs << std::setw(2) << (uint16_t)buf[i+j-1];
+ for (addr_t j = line_size; j > 0; j--)
+ if (i+j < sig_len)
+ sigs << std::setw(2) << (uint16_t)buf[i+j-1];
+ else
+ sigs << std::setw(2) << (uint16_t)0;
sigs << '\n';
}
@@ -276,6 +278,10 @@ void htif_t::parse_arguments(int argc, char ** argv)
case HTIF_LONG_OPTIONS_OPTIND + 4:
payloads.push_back(optarg);
break;
+ case HTIF_LONG_OPTIONS_OPTIND + 5:
+ line_size = atoi(optarg);
+
+ break;
case '?':
if (!opterr)
break;
@@ -310,6 +316,10 @@ void htif_t::parse_arguments(int argc, char ** argv)
c = HTIF_LONG_OPTIONS_OPTIND + 4;
optarg = optarg + 9;
}
+ else if(arg.find("+signature-granularity=")==0){
+ c = HTIF_LONG_OPTIONS_OPTIND + 5;
+ optarg = optarg + 23;
+ }
else if (arg.find("+permissive-off") == 0) {
if (opterr)
throw std::invalid_argument("Found +permissive-off when not parsing permissively");
diff --git a/fesvr/htif.h b/fesvr/htif.h
index 5b16a60..44a3b12 100644
--- a/fesvr/htif.h
+++ b/fesvr/htif.h
@@ -63,6 +63,7 @@ class htif_t : public chunked_memif_t
std::vector<std::string> hargs;
std::vector<std::string> targs;
std::string sig_file;
+ unsigned int line_size;
addr_t sig_addr; // torture
addr_t sig_len; // torture
addr_t tohost_addr;
@@ -100,6 +101,8 @@ class htif_t : public chunked_memif_t
+rfb=DISPLAY to be accessible on 5900 + DISPLAY (default = 0)\n\
--signature=FILE Write torture test signature to FILE\n\
+signature=FILE\n\
+ --signature-granularity=VAL Size of each line in signature.\n\
+ +signature-granularity=VAL\n\
--chroot=PATH Use PATH as location of syscall-servicing binaries\n\
+chroot=PATH\n\
--payload=PATH Load PATH memory as an additional ELF payload\n\
@@ -121,6 +124,7 @@ TARGET (RISC-V BINARY) OPTIONS\n\
{"signature", required_argument, 0, HTIF_LONG_OPTIONS_OPTIND + 2 }, \
{"chroot", required_argument, 0, HTIF_LONG_OPTIONS_OPTIND + 3 }, \
{"payload", required_argument, 0, HTIF_LONG_OPTIONS_OPTIND + 4 }, \
+{"signature-granularity", optional_argument, 0, HTIF_LONG_OPTIONS_OPTIND + 5 }, \
{0, 0, 0, 0}
#endif // __HTIF_H