summaryrefslogtreecommitdiff
path: root/lib/Kratos/DFADriver.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-04-21 14:15:14 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-04-21 14:15:14 +0200
commitbc0bd155d03a8108badd441f8756739565fe300a (patch)
treed9621cb479402d65c514bfc9894f32ce8908dd7f /lib/Kratos/DFADriver.pm
parentf79cec3648491e7d178b372bcc1beaea9baaadef (diff)
allow setting static params via LUT
Diffstat (limited to 'lib/Kratos/DFADriver.pm')
-rw-r--r--lib/Kratos/DFADriver.pm24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/Kratos/DFADriver.pm b/lib/Kratos/DFADriver.pm
index 481dc67..466cf64 100644
--- a/lib/Kratos/DFADriver.pm
+++ b/lib/Kratos/DFADriver.pm
@@ -11,6 +11,7 @@ use AspectC::Repo;
use Carp;
use Carp::Assert::More;
use Cwd;
+use Data::Dumper;
use DateTime;
use Device::SerialPort;
use File::Slurp qw(read_dir read_file write_file);
@@ -554,6 +555,21 @@ sub assess_model_tex {
say '\end{tabular}';
}
+sub assess_workload {
+ my ($self, $workload) = @_;
+
+ $workload =~ s{ \s* \) \s* ; \s* }{:}gx;
+ $workload =~ s{ \s* \) \s* $ }{}gx;
+ $workload =~ s{ \s* ; \s* }{!:}gx;
+ $workload =~ s{ \s* \( \s* }{!}gx;
+ $workload =~ s{ \s* , \s* }{!}gx;
+ $workload =~ s{ [^!] \K $ }{!}gx;
+
+ say $workload;
+
+ my $traces = $self->dfa->run_str_to_trace($workload);
+}
+
sub update_model {
my ($self) = @_;
@@ -739,10 +755,16 @@ sub to_cc {
my $class_name = $self->{class_name};
my @state_enum = $self->model->get_state_enum;
+ my %param_default;
+
+ for my $default_setting (@{$self->{param_default}}) {
+ my ($param, $value) = split(qr{ = }x, $default_setting);
+ $param_default{$param} = $value;
+ }
my $buf
= "DFA_Driver::power_uW_t ${class_name}::statepower[] = {"
- . join( ', ', map { $self->model->get_state_power($_) } @state_enum )
+ . join( ', ', map { sprintf('%.f', $self->model->get_state_power_with_params($_, \%param_default)) } @state_enum )
. "};\n";
return $buf;