Commit bc3be3e4 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Changed FIU_x_PATTERN_y to FIU_x_FAULT_y to avoid confusion.

parent a6c64805
......@@ -268,7 +268,7 @@ sub _get_test_from_stdin {
$i, $t, $cur_cfg
)
);
$test->{"FIU_${i}_PATTERN_${t}"} = REVERSE_FIU_ENUM($cur_cfg);
$test->{"FIU_${i}_FAULT_${t}"} = REVERSE_FIU_ENUM($cur_cfg);
}
}
......@@ -347,7 +347,7 @@ sub _get_test_from_stdin {
# test The hash defining the test
# test->{'TIMER_VALUE_1'}
# test->{'TIMER_VALUE_2'}
# test->{"FIU_[0..FIU_NUM]_PATTERN_[0..CFGS_PER_MSG]"}
# test->{"FIU_[0..FIU_NUM]_FAULT_[0..CFGS_PER_MSG]"}
# test->{'RESET_DUT_AFTER_CONFIG'}
# test->{'TRIGGER'}
# portname Optional serial port to use
......@@ -365,7 +365,7 @@ sub download_test ($$) {
{
for (my $t = 1 ; $t <= $fiji_design_consts->{'CFGS_PER_MSG'} ; $t++)
{
my $k = "FIU_${i}_PATTERN_${t}";
my $k = "FIU_${i}_FAULT_${t}";
my $cur_cfg = FIUENUM->{ $test->{$k} };
$cur_cfg = oct($cur_cfg) if $cur_cfg =~ /^0/;
$logger->debug(
......
......@@ -633,11 +633,12 @@ sub _log2 {
return ($val > 0) ? (log($val)/log(2)) : 0;
}
sub calculate_resources {
sub estimate_resources {
my $logger = get_logger();
my ($settings_ref) = @_;
# FIXME Don't expect these values to hold...
# FIXME where do we put these values? they are likely to change if the VHDL
# source is changed...
my $CTRL_COMB_FACTOR_MIN = 0.85; # c5 ft1
my $CTRL_COMB_FACTOR_MAX = 1.2; # c3de0
......@@ -652,6 +653,8 @@ sub calculate_resources {
my $consts_ref = $settings_ref->{'design'};
my $fiu_ref = $settings_ref->{'fius'};
my $fiubytes = ceil((@$fiu_ref*$consts_ref->{'CFGS_PER_MSG'}*$consts_ref->{'FIU_CFG_BITS'})/8.0);
my $cfgbytes = ($consts_ref->{'TIMER_WIDTH'} * $consts_ref->{'CFGS_PER_MSG'} + 4);
my $comb_min = 0;
my $comb_max = 0;
my $reg = 0;
......@@ -661,65 +664,47 @@ sub calculate_resources {
my $buffer_regs = 0;
my $rv;
# resources for FIC
# Trigger edge detection
$ctrl_regs += 3;
# number of FSM states
$ctrl_regs += 9;
# resources for FIC
my $ctrl_reg_hash = {
TRIGGER_SYNC => 3,
FSM_STATE => 9,
CRC => 8,
ERROR_BITS => 3,
INJ_START => 1,
ID => 16,
CONFIG => 8,
RST_CNTR => ($consts_ref->{'RESET_DUT_IN_EN'}) ? ceil(_log2($consts_ref->{'RESET_DUT_IN_DURATION'})) : 0,
BYTE_CNTR => ceil(_log2(max($fiubytes,$cfgbytes))),
PAT_CNTR => ceil(_log2($consts_ref->{'CFGS_PER_MSG'})) * 2, # we need to store an older value, too
TIMER_STOR => $consts_ref->{'TIMER_WIDTH'} * 8 * $consts_ref->{'CFGS_PER_MSG'}, # value storage
TIMER_VAL => $consts_ref->{'TIMER_WIDTH'} * 8,
TIMER_IDLE => 1
};
my $uart_reg_hash = {
RX_SYNC => 4,
RX_BIT_COUNT => 3,
RX_BAUD_GEN => ceil(_log2($consts_ref->{'FREQUENCY'}/$consts_ref->{'BAUDRATE'})),
RX_STATE => 4,
TX_BIT_COUNT => 3,
TX_BAUD_GEN => ceil(_log2($consts_ref->{'FREQUENCY'}/$consts_ref->{'BAUDRATE'})),
TX_DATA_REG => 8,
TX_OUT_REG => 1,
TX_STATE => 4,
OUT_REGS_TO_CTRL=> 4
};
my $buffer_reg_hash = {
BUFFER_STORAGE => 10, # Buffer width * (Depth+1)
BUFFER_INDEX_RD => 3, # (ceil(log2(depth)) + 1)
BUFFER_INDEX_WR => 3, # (ceil(log2(depth)) + 1)
READER_STATE => 2
};
$logger->debug("Num FIUs: ".@$fiu_ref);
# Number of bytes in a config -> byte counter width
my $fiubytes = ceil((@$fiu_ref*$consts_ref->{'CFGS_PER_MSG'}*$consts_ref->{'FIU_CFG_BITS'})/8.0);
my $cfgbytes = ($consts_ref->{'TIMER_WIDTH'} * $consts_ref->{'CFGS_PER_MSG'} + 4);
$ctrl_regs += ceil(_log2(max($fiubytes,$cfgbytes)));
# CRC
$ctrl_regs += 8; # CRC8
# Error bits
$ctrl_regs += 3; # U/I/C
# Inj-Start bit
$ctrl_regs += 1;
# Reset Counter
$ctrl_regs += ceil(_log2($consts_ref->{'RESET_DUT_IN_DURATION'})) if $consts_ref->{'RESET_DUT_IN_EN'};
# Pattern counter
$ctrl_regs += ceil(_log2($consts_ref->{'CFGS_PER_MSG'})) * 2; # we need to store an older value, too
# ID
$ctrl_regs += 16;
# Timer value storage
$ctrl_regs += $consts_ref->{'TIMER_WIDTH'} * 8 * $consts_ref->{'CFGS_PER_MSG'}; # value storage
# Config
$ctrl_regs += 8; # Config Byte
# Timer Counter value + Idle reg
$ctrl_regs += $consts_ref->{'TIMER_WIDTH'} * 8 + 1;
# resources for UART
$uart_regs += 4; # RX sync
$uart_regs += 3; # RX bit count
$uart_regs += ceil(_log2($consts_ref->{'FREQUENCY'}/$consts_ref->{'BAUDRATE'})); # reciever baud gen
$uart_regs += 4; # RX state
$uart_regs += 3; # TX bit count
$uart_regs += ceil(_log2($consts_ref->{'FREQUENCY'}/$consts_ref->{'BAUDRATE'})); # transmitter baud gen
$uart_regs += 8 + 1; # TX data reg, TX output reg
$uart_regs += 4; # TX state
$uart_regs += 4; # UART -> FIC Output regs
# resources for Buffer
$buffer_regs += 10; # Buffer width * (Depth+1)
$buffer_regs += 3 + 3; # Buffer indices (ceil(log2(depth)) + 1) for rd & wr
$buffer_regs += 2; # Buffer reader state
my $stuck_open_flag = 0;
# resources for FIUs
......@@ -745,12 +730,27 @@ sub calculate_resources {
}
# LFSR will get optimized away if it is not used
$ctrl_regs += $consts_ref->{'LFSR_WIDTH'} if $stuck_open_flag != 0;
$ctrl_reg_hash->{'LFSR'} = $consts_ref->{'LFSR_WIDTH'} if $stuck_open_flag != 0;
# calculate total registers
for my $k (keys(%$ctrl_reg_hash)) {
$ctrl_regs += $ctrl_reg_hash->{$k};
}
$logger->debug("ESTIMATE: CTRL will need ~$ctrl_regs registers");
for my $k (keys(%$uart_reg_hash)) {
$uart_regs += $uart_reg_hash->{$k};
}
$logger->debug("ESTIMATE: UART will need ~$uart_regs registers");
$logger->debug("ESTIMATE: BUFF will need ~$buffer_regs registers");
for my $k (keys(%$buffer_reg_hash)) {
$buffer_regs += $buffer_reg_hash->{$k};
}
$logger->debug("ESTIMATE: BUFFER will need ~$buffer_regs registers");
$logger->debug("ESTIMATE: FIUS will need ~$fiu_regs registers");
$reg = $ctrl_regs + $buffer_regs + $uart_regs + $fiu_regs;
......@@ -765,8 +765,8 @@ sub calculate_resources {
$rv->{'regs'} = ceil($reg/10)*10;
$rv->{'comb_min'} = ceil($comb_min/10)*10;
$rv->{'comb_max'} = ceil($comb_max/10)*10;
$logger->debug("ESTIMATE: current config will need ~$rv->{'regs'} registers and ~$rv->{'comb_min'} - $rv->{'comb_max'} LUTs (tech-dependent)");
$logger->debug("ESTIMATE: current config will need ~$reg registers and ~$comb_min to $comb_max LUTs (tech-dependent)");
$logger->debug("ESTIMATE: current config will need ~$rv->{'regs'} registers and ~$rv->{'comb_min'} to $rv->{'comb_max'} LUTs (tech-dependent)");
return $rv;
}
......
......@@ -516,7 +516,7 @@ sub _read_fiji_cfg ($) {
}
# generate tailored TESTPATMAP for validating test patterns
# clones the original TESTPATMAP and adds FIU_x_PATTERN_y keys
# clones the original TESTPATMAP and adds FIU_x_FAULT_y keys
sub _generate_testpatmap {
my ($self) = @_;
......@@ -533,7 +533,7 @@ sub _generate_testpatmap {
phases_opt => [qw(manual)]};
for (my $fiu_idx = 0; $fiu_idx < $self->{'ext'}->{'global_settings'}->{'design'}->{'FIU_NUM'}; $fiu_idx++) {
my $prop_name = "FIU_${fiu_idx}_PATTERN_${pattern_idx}";
my $prop_name = "FIU_${fiu_idx}_FAULT_${pattern_idx}";
$testpatmap->{$prop_name} = {
ini_name => $prop_name,
default => "NONE",
......@@ -911,7 +911,7 @@ sub export_as_sim_script ($$$) {
for (my $fi = 0; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'}; $fi++) {
# export patterns to simulator commands
$action_text .= $indent;
my $pattern = $test->{"FIU_${fi}_PATTERN_${ci}"};
my $pattern = $test->{"FIU_${fi}_FAULT_${ci}"};
if ($pattern eq "STUCK_AT_0") {
$action_text .= "force -freeze ".@{$global_settings_ref->{'fius'}}[$fi]->{'FIU_NET_NAME'}." '0'; \\\n";
} elsif($pattern eq "STUCK_AT_1") {
......@@ -978,7 +978,7 @@ sub make_random_test {
for(my $pi = 1; $pi <= $global_settings_ref->{'design'}->{'CFGS_PER_MSG'}; $pi++) {
$test->{"TIMER_VALUE_${pi}"} = int(rand($cfg->{'max_duration'}[$pi-1] - $cfg->{'min_duration'}[$pi-1]) + $cfg->{'min_duration'}[$pi-1]);
for(my $fi = 0; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'}; $fi++) {
$test->{"FIU_${fi}_PATTERN_${pi}"} = choose_random_fault($cfg->{'probabilities'});
$test->{"FIU_${fi}_FAULT_${pi}"} = choose_random_fault($cfg->{'probabilities'});
}
}
......
......@@ -238,7 +238,7 @@ sub update {
####
## Calc resource estimate
my $rh = FIJI::Settings::calculate_resources($self->{'settings'});
my $rh = FIJI::Settings::estimate_resources($self->{'settings'});
${$self->{'resources'}} = "~".$rh->{'regs'}." Registers, ".$rh->{'comb_min'}." - ".$rh->{'comb_max'}." LUTs (tech-dependent)";
}
......@@ -260,7 +260,7 @@ sub _populate_widget {
-label=>'Design Constants',
-underline=>0);
$pg_fius = $nb->add('fius',
-label=>'fius',
-label=>'FIUs',
-underline=>0);
$pg_design->DynaMouseWheelBind('Tk::Pane');
################
......@@ -625,7 +625,7 @@ sub _update_fields {
$mask_entry->validate();
####
## Calc resource estimate
my $rh = FIJI::Settings::calculate_resources($self->{'settings'});
my $rh = FIJI::Settings::estimate_resources($self->{'settings'});
${$self->{'resources'}} = "~".$rh->{'regs'}." Registers, ".$rh->{'comb_min'}." - ".$rh->{'comb_max'}." LUTs (tech-dependent)";
}
......@@ -706,7 +706,7 @@ sub _validate_entry {
####
## Calc resource estimate
my $rh = FIJI::Settings::calculate_resources($self->{'settings'});
my $rh = FIJI::Settings::estimate_resources($self->{'settings'});
${$self->{'resources'}} = "~".$rh->{'regs'}." Registers, ".$rh->{'comb_min'}." - ".$rh->{'comb_max'}." LUTs (tech-dependent)";
return 1; # always allow the new value and show the user what happened.
......
......@@ -77,7 +77,7 @@ sub _hh {
}
for(my $fi = 0; $fi < $global_settings->{'design'}->{'FIU_NUM'}; $fi++) {
my $ps = "FIU_${fi}_PATTERN_${pattern}";
my $ps = "FIU_${fi}_FAULT_${pattern}";
$fiucfg .= "\nFIU $fi: $test->{$ps}";
}
......
......@@ -122,13 +122,13 @@ sub _populate_widget ($) {
$ff->Optionmenu(
'-options' => \@optionlist,
'-width' => 15,
'-variable' => \$self->{'test'}->{"FIU_${fi}_PATTERN_1"}
'-variable' => \$self->{'test'}->{"FIU_${fi}_FAULT_1"}
)->grid(-column=>1,-row=>($ri));
$ff->Optionmenu(
'-options' => \@optionlist,
'-width' => 15,
'-variable' => \$self->{'test'}->{"FIU_${fi}_PATTERN_2"}
'-variable' => \$self->{'test'}->{"FIU_${fi}_FAULT_2"}
)->grid(-column=>2,-row=>($ri));
}
$tf->pack();
......
......@@ -2,7 +2,7 @@
// It should be able to generate net objects and interconnect all of the
// nets, pins and ports correctly
module(a,b,c);
module mod(a,b,c);
input [3:0] a;
input b;
output [7:0] c;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment