Initial derivgen working

This commit is contained in:
David Harris 2024-01-29 11:22:34 -08:00
parent fb35a865ef
commit d52d2d7983
3 changed files with 13 additions and 27 deletions

1
.gitignore vendored
View File

@ -184,3 +184,4 @@ sim/cfi/*
sim/branch/* sim/branch/*
sim/obj_dir sim/obj_dir
examples/verilog/fulladder/obj_dir examples/verilog/fulladder/obj_dir
config/deriv

View File

@ -55,30 +55,21 @@ foreach my $line (<$fh>) {
&terminateDeriv(); &terminateDeriv();
$curderiv = $tokens[1]; $curderiv = $tokens[1];
$basederiv{$curderiv} = $tokens[2]; $basederiv{$curderiv} = $tokens[2];
# print("Found deriv $curderiv based on $basederiv{$curderiv}\n");
@derivlist = (); @derivlist = ();
if ($#tokens > 2) { if ($#tokens > 2) {
# print(" with $tokens[3]\n");
my $inherits = $derivs{$tokens[3]}; my $inherits = $derivs{$tokens[3]};
# &printref($inherits);
@derivlist = @{$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 } else { # add to the current derivative
my @entry = ($tokens[0], $tokens[1]); my @entry = ($tokens[0], $tokens[1]);
# print(" Read Entry: @entry\n");
push(@derivlist, \@entry); push(@derivlist, \@entry);
} }
} }
&terminateDeriv(); &terminateDeriv();
close($fh); close($fh);
#system("mkdir $ENV{WALLY}/config/deriv");
foreach my $key (keys %derivs) { foreach my $key (keys %derivs) {
my $dir = "$ENV{WALLY}/config/deriv/$key"; my $dir = "$ENV{WALLY}/config/deriv/$key";
system("rm -rf $dir");
system("mkdir -p $dir"); system("mkdir -p $dir");
my $configunmod = "$dir/config_unmod.vh"; my $configunmod = "$dir/config_unmod.vh";
my $config = "$dir/config.vh"; my $config = "$dir/config.vh";
@ -92,40 +83,29 @@ foreach my $key (keys %derivs) {
foreach my $line (<$unmod>) { foreach my $line (<$unmod>) {
foreach my $entry (@{$derivs{$key}}) { foreach my $entry (@{$derivs{$key}}) {
my @ent = @{$entry}; my @ent = @{$entry};
my $param = @ent[0]; my $param = $ent[0];
my $value = @ent[1]; my $value = $ent[1];
print(" In $config replace $param with $value\n"); if ($line =~ s/$param\s*=\s*.*;/$param = $value;/g) {
# $line =~ s/^\s*`define\s+$param\s+.*$/`define $param $value/; print("Hit: new line in $config is $line");
$line =~ s/$param\s*=\s*.*;/$param = $value;/; #print $fh $line;
}
} }
print $fh $line; print $fh $line;
} }
close($fh); close($fh);
close($unmod); close($unmod);
} }
#print("#######################\nKeys: ", join(' ', keys %derivs), "\n");
#foreach my $key (keys %derivs) {
# print(" $key: $basederiv{$key} = ");
# &printref($derivs{$key});
#}
sub terminateDeriv { sub terminateDeriv {
if ($curderiv ne "") { # close out the previous derivative if ($curderiv ne "") { # close out the previous derivative
my @dl = @derivlist; my @dl = @derivlist;
$derivs{$curderiv} = \@dl; $derivs{$curderiv} = \@dl;
# print("Finished: $curderiv = $derivs{$curderiv} ");
# &printref($derivs{$curderiv});
} }
}; };
sub printref { sub printref {
my $ref = shift; my $ref = shift;
my @array = @{$ref}; my @array = @{$ref};
# print(" ## Printing ref $ref\n ");
foreach my $entry (@array) { foreach my $entry (@array) {
print join('_', @{$entry}), ', '; print join('_', @{$entry}), ', ';
} }

View File

@ -35,6 +35,7 @@
# If <inherited config name> is not empty, all the list of parameter changes in the inherited # If <inherited config name> is not empty, all the list of parameter changes in the inherited
# configuration are also applied to this configuration # configuration are also applied to this configuration
# buildroot is used for the Linux boot
deriv buildroot rv64gc deriv buildroot rv64gc
RESET_VECTOR 64'h1000 RESET_VECTOR 64'h1000
UNCORE_RAM_RANGE 64'h0FFFFFFF UNCORE_RAM_RANGE 64'h0FFFFFFF
@ -44,6 +45,7 @@ SPI_LOOBACK_TEST 0
UART_PRESCALE 0 UART_PRESCALE 0
PLIC_NUM_SRC 32'd53 PLIC_NUM_SRC 32'd53
# fpga is used for FPGA hardware. It adds the SDC and DDR (EXT_MEM)
deriv fpga rv64gc buildroot deriv fpga rv64gc buildroot
BOOTROM_PRELOAD 1 BOOTROM_PRELOAD 1
UNCORE_RAM_BASE 64'h2000 UNCORE_RAM_BASE 64'h2000
@ -55,6 +57,7 @@ SDC_SUPPORTED 1
PLIC_SDC_ID 32'd20 PLIC_SDC_ID 32'd20
BPRED_SIZE 32'd12 BPRED_SIZE 32'd12
# The syn configurations are trimmed down for faster synthesis.
deriv syn_rv32e rv32e deriv syn_rv32e rv32e
DTIM_RANGE 32'h1FF DTIM_RANGE 32'h1FF
IROM_RANGE 32'h1FF IROM_RANGE 32'h1FF
@ -66,8 +69,10 @@ NUMWAYS 32'd1
BPRED_SIZE 32'd5 BPRED_SIZE 32'd5
BTB_SIZE 32'd5 BTB_SIZE 32'd5
# The other syn configurations have the same trimming
deriv syn_rv32i rv32i syn_rv32e deriv syn_rv32i rv32i syn_rv32e
deriv syn_rv32imc rv32imc syn_rv32e deriv syn_rv32imc rv32imc syn_rv32e
deriv syn_rv32gc rv32gc syn_rv32e deriv syn_rv32gc rv32gc syn_rv32e
deriv syn_rv64i rv64i syn_rv32e deriv syn_rv64i rv64i syn_rv32e
deriv syn_rv64gc rv64gc syn_rv32e deriv syn_rv64gc rv64gc syn_rv32e