From e3b28db969a6f5df194456d193e7b8c79611fa5d Mon Sep 17 00:00:00 2001 From: David Harris Date: Fri, 23 Apr 2021 19:04:16 -0400 Subject: [PATCH] Fixed exe2memfile.pl to handle large files --- wally-pipelined/bin/exe2memfile.pl | 21 +++++++++++++++------ wally-pipelined/testgen/testgen-PIPELINE.py | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/wally-pipelined/bin/exe2memfile.pl b/wally-pipelined/bin/exe2memfile.pl index 79b975c7a..e681f8419 100755 --- a/wally-pipelined/bin/exe2memfile.pl +++ b/wally-pipelined/bin/exe2memfile.pl @@ -13,12 +13,13 @@ if ($#ARGV == -1) { } # array to hold contents of memory file -my @memfilebytes = (0)*16384*4; +my $maxmemfilesize = 1000000; +my @memfilebytes = (0)*$maxmemfilesize*4; my $maxaddress = 0; STDOUT->autoflush(1); -# *** Ross Thompson I think there is a bug here needs to be +1 -print ("Processing $#ARGV memfiles: "); +my $numfiles = $#ARGV+1; +print ("Processing $numfiles memfiles: "); my $frac = $#ARGV/10; for(my $i=0; $i<=$#ARGV; $i++) { if ($i < 10 || $i % $frac == 0) { print ("$i ") }; @@ -43,7 +44,7 @@ for(my $i=0; $i<=$#ARGV; $i++) { my $address; # initialize to all zeros; - for (my $i=0; $i < 65536*4; $i++) { + for (my $i=0; $i < $maxmemfilesize*4; $i++) { $memfilebytes[$i] = "00"; } @@ -84,7 +85,11 @@ for(my $i=0; $i<=$#ARGV; $i++) { open(MEMFILE, ">$memfile") || die("Can't write $memfile"); for (my $i=0; $i<= $maxaddress; $i = $i + 4) { for ($j=3; $j>=0; $j--) { - print MEMFILE "$memfilebytes[$i+$j]"; + if (defined($memfilebytes[$i+$j])) { + print MEMFILE "$memfilebytes[$i+$j]"; + } else { + print MEMFILE "00"; + } } print MEMFILE "\n"; } @@ -93,7 +98,11 @@ for(my $i=0; $i<=$#ARGV; $i++) { open(MEMFILE, ">$memfile") || die("Can't write $memfile"); for (my $i=0; $i<= $maxaddress; $i = $i + 8) { for ($j=7; $j>=0; $j--) { - print MEMFILE "$memfilebytes[$i+$j]"; + if (defined($memfilebytes[$i+$j])) { + print MEMFILE "$memfilebytes[$i+$j]"; + } else { + print MEMFILE "00"; + } } print MEMFILE "\n"; } diff --git a/wally-pipelined/testgen/testgen-PIPELINE.py b/wally-pipelined/testgen/testgen-PIPELINE.py index 15dc73201..3023cb7ae 100755 --- a/wally-pipelined/testgen/testgen-PIPELINE.py +++ b/wally-pipelined/testgen/testgen-PIPELINE.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python ################################################################################################### # testgen-PIPELINE.py # @@ -1716,7 +1716,7 @@ InstrTypes = { 'R' : ['add', 'sub', 'sll', 'slt', 'sltu', 'xor', 'srl', 'sra', XLEN = ['32'] INSTRUCTION_TYPE = ['I'] -NUMINSTR = 10000 +NUMINSTR = 70000 IMPERASPATH = "../../imperas-riscv-tests/riscv-test-suite/" seed(42)