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

Added trigger button to basys3 demo docu

parent 2db61f5b
......@@ -295,7 +295,9 @@ sub download_manual ($;$) {
my $msg;
my $logger = get_logger("");
my ($self, $run_ref, $portname) = @_;
my ($self, $run_ref, $portname, $once) = @_;
$once = 0 if (!defined $once);
my $fiji_design_consts = $self->{'fiji_settings'}->{'design'};
my $fiji_tests_consts = $self->{'fiji_tests'}->{'design'};
......@@ -308,9 +310,13 @@ sub download_manual ($;$) {
$logger->info("Downloading in manual mode.");
while (1) {
do {
my $test = $self->_get_test_from_stdin();
return "Test execution failed" unless defined $test;
return undef if (ref($test) ne "HASH" && $test eq "EOF");
my $recv_msg = $self->_download_test($run_ref, $test, $port, 0);
return $recv_msg if (ref($recv_msg) ne "HASH");
......@@ -320,7 +326,7 @@ sub download_manual ($;$) {
return $msg;
}
}
} while (!$once);
return $msg;
}
......@@ -343,7 +349,7 @@ sub _get_test_from_stdin {
printf("Enter configuration for FIU #%d %s (default: 0x%x): ", $i, $phase, $default_cfg);
my $cfg_str = <STDIN>;
last unless defined $cfg_str;
goto PREMATURE_EOF unless defined $cfg_str;
$cfg_str =~ s/\R//g; # remove line breaks globally
# $cfg_str =~ s/^0x//i; # remove optional 0x prefix
# if ($cfg_str !~ m/^[0-9A-F]+$|^$/i) {
......@@ -362,7 +368,7 @@ sub _get_test_from_stdin {
oct("0x" . ("FF" x ($fiji_design_consts->{'TIMER_WIDTH'} / 8))) / 2;
printf("Enter duration t1 (default: 0x%x): ", $default_t1_dur);
$test->{'TIMER_VALUE_1'} = <STDIN>;
last unless defined $test->{'TIMER_VALUE_1'};
goto PREMATURE_EOF unless defined $test->{'TIMER_VALUE_1'};
$test->{'TIMER_VALUE_1'} =~ s/\R//g; # remove line breaks globally
$test->{'TIMER_VALUE_1'} =
int((length($test->{'TIMER_VALUE_1'}) == 0) ? $default_t1_dur : $test->{'TIMER_VALUE_1'});
......@@ -374,7 +380,7 @@ sub _get_test_from_stdin {
oct("0x" . ("FF" x ($fiji_design_consts->{'TIMER_WIDTH'} / 8))) / 2;
printf("Enter duration t2 (default: 0x%x): ", $default_t2_dur);
$test->{'TIMER_VALUE_2'} = <STDIN>;
last unless defined $test->{'TIMER_VALUE_2'};
goto PREMATURE_EOF unless defined $test->{'TIMER_VALUE_2'};
$test->{'TIMER_VALUE_2'} =~ s/\R//g; # remove line breaks globally
$test->{'TIMER_VALUE_2'} =
int((length($test->{'TIMER_VALUE_2'}) == 0) ? $default_t2_dur : $test->{'TIMER_VALUE_2'});
......@@ -383,7 +389,7 @@ sub _get_test_from_stdin {
printf("Enable trigger (default: 0)? ");
my $trigger_en = <STDIN>;
last unless defined $trigger_en;
goto PREMATURE_EOF unless defined $trigger_en;
$trigger_en =~ s/\R//g; # remove line breaks globally
$trigger_en = ($trigger_en =~ /1|yes|y/i) ? 1 : 0;
$logger->debug(sprintf("trigger is %sabled.", $trigger_en == 0 ? "dis" : "en"));
......@@ -392,7 +398,7 @@ sub _get_test_from_stdin {
if ($trigger_en) {
printf("Use external/not internal trigger (default: 0)? ");
$trigger_ext = <STDIN>;
last unless defined $trigger_ext;
goto PREMATURE_EOF unless defined $trigger_ext;
$trigger_ext =~ s/\R//g; # remove line breaks globally
$trigger_ext = ($trigger_ext =~ /1|yes|y/i) ? 1 : 0;
$logger->debug(sprintf("External trigger is %sabled, internal trigger is %sabled.", $trigger_ext == 0 ? "dis" : "en", $trigger_ext != 0 ? "dis" : "en"));
......@@ -407,12 +413,16 @@ sub _get_test_from_stdin {
printf("Enable reset (default: 0)? ");
$test->{'RST_DUT_AFTER_CFG'} = <STDIN>;
last unless defined $test->{'RST_DUT_AFTER_CFG'};
goto PREMATURE_EOF unless defined $test->{'RST_DUT_AFTER_CFG'};
$test->{'RST_DUT_AFTER_CFG'} =~ s/\R//g; # remove line breaks globally
$test->{'RST_DUT_AFTER_CFG'} = ($test->{'RST_DUT_AFTER_CFG'} =~ /1|yes|y/i) ? 1 : 0;
$logger->debug(sprintf("reset is %sabled.", $test->{'RST_DUT_AFTER_CFG'} == 0 ? "dis" : "en"));
return $test;
PREMATURE_EOF:
$logger->fatal("Premature EOF");
return "EOF";
}
sub get_fic_status ($$) {
......
......@@ -148,12 +148,14 @@ sub main {
my $faulty_tests = {};
my $starttime = time;
$cfg->{'one-shot'} = 0 if (!defined $cfg->{'one-shot'});
# Check mode and execute tests accordingly
my $downloader_reply;
if ($cfg->{'mode'} eq "auto") {
$downloader_reply = $fiji_downloader->download_auto(\1, \$faulty_tests, $cfg->{'portname'});
} elsif ($cfg->{'mode'} eq "manual") {
$downloader_reply = $fiji_downloader->download_manual(\1, $cfg->{'portname'});
$downloader_reply = $fiji_downloader->download_manual(\1, $cfg->{'portname'}, $cfg->{'one-shot'});
} elsif ($cfg->{'mode'} eq "random") {
$downloader_reply = $fiji_downloader->update_dur($dur);
if (!defined $downloader_reply) {
......@@ -232,6 +234,7 @@ GetOptions(
"f|prob-seu=f" => \($prob->{'PROB_SEU'}),
"o|prob-so=f" => \($prob->{'PROB_STUCK_OPEN'}),
"i|interactive" => \($cfg->{'interactive'}),
"z|one-shot" => \($cfg->{'one-shot'}),
"v|verbose+" => \($cfg->{'verbosity_delta'}),
"h|help" => \($cfg->{'help'}),
)
......
......@@ -185,7 +185,7 @@ sub main {
$mw->resizable(1, 1);
$splash=$mw->toplevel->Frame();
$splash->Label(-font => [-size => 16], -text => "Loading Netlist - Please wait...",-height=>2,)->pack(-side=>'bottom',-fill=>'both');
$splash->Label(-image => Tk::FIJIUtils::logo_image($self->{'mw'}))->pack(-side=>'bottom',-expand=>1,-fill=>'both');
$splash->Frame()->pack(-side=>'bottom',-expand=>1,-fill=>"both")->Label(-relief=>"ridge", -borderwidth=>3,-image => Tk::FIJIUtils::logo_image($self->{'mw'}))->pack(-side=>'bottom',-expand=>1,-ipadx=>10,-ipady=>10);
$mw->update();
#
......
......@@ -17,7 +17,7 @@
SHELL=/bin/bash
EDITOR?=nano
DBG?=no
BOARD?=zybo
BOARD?=basys3
PERLFLAGS=-I $(FIJI_SCRIPT_DIR)/FIJI -I $(FIJI_SCRIPT_DIR) -I $(FIJI_SCRIPT_DIR)/Log
# FIJI environment
FIJI_SCRIPT_DIR=../../../bin
......
......@@ -52,6 +52,7 @@ In a real-world design the states of the redundant units would usually be determ
The design generates a 640x480 @ 25Mhz VGA signal.
\item The dip-switch SW0 controls if TMR is enabled (towards the board edge is off).
\item BTNC resets the design when pressed.
\item The external trigger is activated when BTNU is pressed.
\item The four rightmost LEDs above the dip switches (LD0-LD3) show the error detection state:
\begin{itemize}
\item LD0 shows if any error has been detected.
......@@ -75,6 +76,7 @@ In a real-world design the states of the redundant units would usually be determ
The design generates a 640x480 @ 25Mhz VGA signal.
\item The dip-switch SW0 controls if TMR is enabled.
\item BTN0 resets the design when pressed.
% FIXME: External Trigger
\item The LEDs above the dip switches (LD0-LD3) show the error detection state:
\begin{itemize}
\item LD0 shows if any error has been detected.
......@@ -98,6 +100,7 @@ In a real-world design the states of the redundant units would usually be determ
The design generates a 640x480 @ 25Mhz VGA signal.
\item The dip-switch SW0 controls if TMR is enabled (towards the board edge is off).
\item BUTTON0 resets the design.
% FIXME: External Trigger
\item The green LEDs above the three buttons (LEDG0-LEDG3) show the error detection state:
\begin{itemize}
\item LEDG0 shows if any error has been detected.
......
......@@ -179,12 +179,12 @@ begin
s_crc_error <= '0';
-- initialize the reset counter to the specified reset duration
s_reset_counter <= to_unsigned(c_reset_dut_in_duration - 2, s_reset_counter'length);
s_reset_counter <= to_unsigned(c_reset_dut_in_duration, s_reset_counter'length) - 2;
-- pattern counter starts last pattern (previous fault pattern '2' with 2 faults)
s_pattern_counter <= to_unsigned(c_num_patterns - 1, s_pattern_counter'length);
s_pattern_counter <= to_unsigned(c_num_patterns, s_pattern_counter'length) - 1;
-- fi pattern starts from last pattern (previous fault pattern '2' with 2 faults)
s_fi_pattern <= to_unsigned(c_num_patterns - 1, s_pattern_counter'length);
s_fi_pattern <= to_unsigned(c_num_patterns, s_pattern_counter'length) - 1;
elsif s_clk_i'event and s_clk_i = '1' then
-- enable start is only a pulse
......@@ -288,7 +288,7 @@ begin
s_controller_state <= CONTROL_FSM_WAIT_TRIGGER;
elsif s_config_recv(c_config_bit_r) = '1' then -- don't wait for trigger, but apply reset first
-- load the reset counter with the specified reset duration
s_reset_counter <= to_unsigned(c_reset_dut_in_duration - 2, s_reset_counter'length);
s_reset_counter <= to_unsigned(c_reset_dut_in_duration, s_reset_counter'length) - 2;
s_controller_state <= CONTROL_FSM_APPLY_RESET;
else
s_controller_state <= CONTROL_FSM_WAIT_DURS; -- immediately start injection
......@@ -299,7 +299,7 @@ begin
if s_trigger_edge = '1' then -- an inactive-active transition
if s_config_recv(c_config_bit_r) = '1' then -- apply reset first
-- load the reset counter with the specified reset duration
s_reset_counter <= to_unsigned(c_reset_dut_in_duration - 2, s_reset_counter'length);
s_reset_counter <= to_unsigned(c_reset_dut_in_duration, s_reset_counter'length) - 2;
s_controller_state <= CONTROL_FSM_APPLY_RESET;
else
s_controller_state <= CONTROL_FSM_WAIT_DURS; -- immediately start injection
......
......@@ -13,6 +13,7 @@ fic-emulator: fic-emulator.c $(FIJI_CFG_FILE)
-DFIU_CFG_BITS=$(FIU_CFG_BITS) \
-DCFGS_PER_MSG=$(CFGS_PER_MSG) \
-DTIMER_BYTES=$(TIMER_BYTES) \
-DEXPORT \
-o $@
fic-emulator-debug: fic-emulator.c $(FIJI_CFG_FILE)
......@@ -29,4 +30,4 @@ fic-emulator-debug: fic-emulator.c $(FIJI_CFG_FILE)
clean:
rm -f dummy
\ No newline at end of file
rm -f dummy
......@@ -303,6 +303,21 @@ int main (int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
#ifdef EXPORT
FILE *fp = fopen("message","w");
if (fp) {
for (int i = 0; i < NUM_BYTES; i++) {
char byte[9];
byte[8] = '\0';
for (int j = 0; j < 8; j++) {
byte[j] = (in[i]&(1 << (7-j))) ? '1' : '0';
}
fprintf(fp,"0%s\n",byte);
}
fclose(fp);
}
#endif
#ifdef DEBUG
for (int i = 0; i < NUM_BYTES; i++) {
fprintf(stderr,"%02d: 0x%02x\n",i, in[i]);
......
Markdown is supported
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