From d52d2d79832adccf3d6eac0b0cc54ab75a850ec1 Mon Sep 17 00:00:00 2001 From: David Harris Date: Mon, 29 Jan 2024 11:22:34 -0800 Subject: [PATCH] Initial derivgen working --- .gitignore | 1 + bin/derivgen.pl | 34 +++++++--------------------------- config/derivlist.txt | 5 +++++ 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 26cfe6b84..a01f1c07d 100644 --- a/.gitignore +++ b/.gitignore @@ -184,3 +184,4 @@ sim/cfi/* sim/branch/* sim/obj_dir examples/verilog/fulladder/obj_dir +config/deriv diff --git a/bin/derivgen.pl b/bin/derivgen.pl index 4074fd08e..6fe84fdfe 100755 --- a/bin/derivgen.pl +++ b/bin/derivgen.pl @@ -55,30 +55,21 @@ foreach my $line (<$fh>) { &terminateDeriv(); $curderiv = $tokens[1]; $basederiv{$curderiv} = $tokens[2]; -# print("Found deriv $curderiv based on $basederiv{$curderiv}\n"); @derivlist = (); if ($#tokens > 2) { -# print(" with $tokens[3]\n"); my $inherits = $derivs{$tokens[3]}; -# &printref($inherits); @derivlist = @{$inherits}; -# foreach my $entry (@derivlist) { -# print(" Entry: @$entry\n"); -# } -# print (" dt3 = $inherits as array @derivlist\n"); -# print(" derivlist = @derivlist\n"); */ } } else { # add to the current derivative my @entry = ($tokens[0], $tokens[1]); -# print(" Read Entry: @entry\n"); push(@derivlist, \@entry); } } &terminateDeriv(); close($fh); -#system("mkdir $ENV{WALLY}/config/deriv"); foreach my $key (keys %derivs) { my $dir = "$ENV{WALLY}/config/deriv/$key"; + system("rm -rf $dir"); system("mkdir -p $dir"); my $configunmod = "$dir/config_unmod.vh"; my $config = "$dir/config.vh"; @@ -92,40 +83,29 @@ foreach my $key (keys %derivs) { foreach my $line (<$unmod>) { foreach my $entry (@{$derivs{$key}}) { my @ent = @{$entry}; - my $param = @ent[0]; - my $value = @ent[1]; - print(" In $config replace $param with $value\n"); -# $line =~ s/^\s*`define\s+$param\s+.*$/`define $param $value/; - $line =~ s/$param\s*=\s*.*;/$param = $value;/; + my $param = $ent[0]; + my $value = $ent[1]; + if ($line =~ s/$param\s*=\s*.*;/$param = $value;/g) { + print("Hit: new line in $config is $line"); + #print $fh $line; + } } print $fh $line; } close($fh); close($unmod); - - - } -#print("#######################\nKeys: ", join(' ', keys %derivs), "\n"); -#foreach my $key (keys %derivs) { -# print(" $key: $basederiv{$key} = "); -# &printref($derivs{$key}); -#} - sub terminateDeriv { if ($curderiv ne "") { # close out the previous derivative my @dl = @derivlist; $derivs{$curderiv} = \@dl; -# print("Finished: $curderiv = $derivs{$curderiv} "); -# &printref($derivs{$curderiv}); } }; sub printref { my $ref = shift; my @array = @{$ref}; -# print(" ## Printing ref $ref\n "); foreach my $entry (@array) { print join('_', @{$entry}), ', '; } diff --git a/config/derivlist.txt b/config/derivlist.txt index 554697e62..0ba20e793 100644 --- a/config/derivlist.txt +++ b/config/derivlist.txt @@ -35,6 +35,7 @@ # If is not empty, all the list of parameter changes in the inherited # configuration are also applied to this configuration +# buildroot is used for the Linux boot deriv buildroot rv64gc RESET_VECTOR 64'h1000 UNCORE_RAM_RANGE 64'h0FFFFFFF @@ -44,6 +45,7 @@ SPI_LOOBACK_TEST 0 UART_PRESCALE 0 PLIC_NUM_SRC 32'd53 +# fpga is used for FPGA hardware. It adds the SDC and DDR (EXT_MEM) deriv fpga rv64gc buildroot BOOTROM_PRELOAD 1 UNCORE_RAM_BASE 64'h2000 @@ -55,6 +57,7 @@ SDC_SUPPORTED 1 PLIC_SDC_ID 32'd20 BPRED_SIZE 32'd12 +# The syn configurations are trimmed down for faster synthesis. deriv syn_rv32e rv32e DTIM_RANGE 32'h1FF IROM_RANGE 32'h1FF @@ -66,8 +69,10 @@ NUMWAYS 32'd1 BPRED_SIZE 32'd5 BTB_SIZE 32'd5 +# The other syn configurations have the same trimming deriv syn_rv32i rv32i syn_rv32e deriv syn_rv32imc rv32imc syn_rv32e deriv syn_rv32gc rv32gc syn_rv32e deriv syn_rv64i rv64i syn_rv32e deriv syn_rv64gc rv64gc syn_rv32e +