mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Fixed exe2memfile.pl to handle large files
This commit is contained in:
		
							parent
							
								
									5b41ae6a2e
								
							
						
					
					
						commit
						9415e00bfa
					
				@ -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";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user