Line 106... |
Line 106... |
|
|
|
|
-- Stimulus process
|
-- Stimulus process
|
stim_proc: process
|
stim_proc: process
|
|
|
file infile :text is in "wejscie.txt";
|
file infile :text is in "input.txt";
|
variable line_in :line;
|
variable line_in :line;
|
variable bytes : std_logic_vector(32 downto 0);
|
variable bytes : std_logic_vector(32 downto 0);
|
variable bytes2 : std_logic_vector(3 downto 0);
|
variable bytes2 : std_logic_vector(3 downto 0);
|
variable xbit : std_logic;
|
variable xbit : std_logic;
|
|
|
Line 183... |
Line 183... |
|
|
outs: PROCESS (strobe)
|
outs: PROCESS (strobe)
|
variable str :string(1 to 29);
|
variable str :string(1 to 29);
|
variable lineout :line;
|
variable lineout :line;
|
variable init_file :std_logic := '1';
|
variable init_file :std_logic := '1';
|
file outfile :text is out "wyjscie.txt";
|
file outfile :text is out "output.txt";
|
|
|
-------- funkcja konwersji: std_logic_vector => character --------
|
-------- conversion function: std_logic_vector => character --------
|
function conv_to_hex_char (sig: std_logic_vector(3 downto 0)) RETURN character IS
|
function conv_to_hex_char (sig: std_logic_vector(3 downto 0)) RETURN character IS
|
begin
|
begin
|
case sig is
|
case sig is
|
when "0000" => return '0';
|
when "0000" => return '0';
|
when "0001" => return '1';
|
when "0001" => return '1';
|
Line 208... |
Line 208... |
when "1110" => return 'E';
|
when "1110" => return 'E';
|
when others => return 'F';
|
when others => return 'F';
|
end case;
|
end case;
|
end conv_to_hex_char;
|
end conv_to_hex_char;
|
|
|
-------- funkcja konwersji: std_logic => character --------
|
-------- conversion function: std_logic => character --------
|
function conv_to_char (sig: std_logic) RETURN character IS
|
function conv_to_char (sig: std_logic) RETURN character IS
|
begin
|
begin
|
case sig is
|
case sig is
|
when '1' => return '1';
|
when '1' => return '1';
|
when '0' => return '0';
|
when '0' => return '0';
|
when 'Z' => return 'Z';
|
when 'Z' => return 'Z';
|
when others => return 'X';
|
when others => return 'X';
|
end case;
|
end case;
|
end conv_to_char;
|
end conv_to_char;
|
|
|
-------- funkcja konwersji: std_logic_vector => string --------
|
-------- conversion function: std_logic_vector => string --------
|
function conv_to_string (inp: std_logic_vector; length: integer) RETURN string IS
|
function conv_to_string (inp: std_logic_vector; length: integer) RETURN string IS
|
variable x : integer := length/4;
|
variable x : integer := length/4;
|
variable s : string(1 to x);
|
variable s : string(1 to x);
|
begin
|
begin
|
for i in 0 to (x-1) loop
|
for i in 0 to (x-1) loop
|
Line 232... |
Line 232... |
return s;
|
return s;
|
end conv_to_string;
|
end conv_to_string;
|
|
|
-------------------------------------
|
-------------------------------------
|
begin
|
begin
|
-------- nagłówek pliku wyjściowego (podział kolumn) --------
|
-------- output file header (columns) --------
|
if init_file = '1' then
|
if init_file = '1' then
|
str:="clk ";
|
str:="clk ";
|
write(lineout,str); writeline(outfile,lineout);
|
write(lineout,str); writeline(outfile,lineout);
|
str:="| reset ";
|
str:="| reset ";
|
write(lineout,str); writeline(outfile,lineout);
|
write(lineout,str); writeline(outfile,lineout);
|
Line 251... |
Line 251... |
str:="| | | | | | ";
|
str:="| | | | | | ";
|
write(lineout,str); writeline(outfile,lineout);
|
write(lineout,str); writeline(outfile,lineout);
|
init_file := '0';
|
init_file := '0';
|
end if;
|
end if;
|
|
|
-------- zapis danych do pliku wyjsciowego „wyjscie” --------
|
-------- write to output „output” --------
|
if (strobe'EVENT and strobe='0') then
|
if (strobe'EVENT and strobe='0') then
|
str := (others => ' ');
|
str := (others => ' ');
|
str(1) := conv_to_char(clk);
|
str(1) := conv_to_char(clk);
|
str(2) := '|';
|
str(2) := '|';
|
str(3) := conv_to_char(reset);
|
str(3) := conv_to_char(reset);
|