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/obj_dir
examples/verilog/fulladder/obj_dir
config/deriv

View File

@ -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}), ', ';
}

View File

@ -35,6 +35,7 @@
# If <inherited config name> 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