33use ieee.std_logic_1164.
all;
34use ieee.numeric_std.
all;
35use ieee.std_logic_textio.
all;
101 file fstim : text open read_mode is "tb_serport_uart_rx_stim";
102 variable iline : line;
103 variable oline : line;
104 variable idelta : integer := 0;
105 variable itxdata : slv8 := (others=>'0');
106 variable irxval : slbit := '0';
107 variable irxerr : slbit := '0';
108 variable irxdata : slv8 := (others=>'0');
109 variable ok : boolean;
110 variable dname : string(1 to 6) := (others=>' ');
111 variable irate : integer := 16;
113 type bit_10_array_type
is array(0 to 9) of slbit;
114 type int_10_array_type
is array(0 to 9) of integer;
115 variable valpuls : bit_10_array_type := (others=>'0');
116 variable delpuls : int_10_array_type := (others=>0);
117 variable npuls : integer := 0;
123 file_loop: while not endfile(fstim) loop
125 readline (fstim, iline);
127 readcomment(iline, ok);
128 next file_loop when ok;
130 readword(iline, dname, ok);
134 write(oline, string'(".reset"));
135 writeline(output, oline);
142 read_ea(iline, idelta);
149 idelta := idelta + 1;
150 exit when idelta>3000;
152 read_ea(iline, irate);
158 read_ea(iline, irate);
161 writetimestamp(oline, CLK_CYCLE, ": puls ");
163 read_ea(iline, irxval);
164 read_ea(iline, irxerr);
165 read_ea(iline, irxdata);
168 for i in valpuls'range loop
169 testempty(iline, ok);
173 read_ea(iline, valpuls(i));
174 read_ea(iline, delpuls(i));
176 report "assert puls length > 0" severity failure;
178 write(oline, valpuls(i), right, 3);
179 write(oline, delpuls(i), right, 3);
181 writeline(output, oline);
187 for i in 0 to npuls-1 loop
196 read_ea(iline, idelta);
197 read_ea(iline, itxdata);
202 writetimestamp(oline, CLK_CYCLE, ": send ");
203 write(oline, itxdata, right, 10);
204 writeline(output, oline);
216 for i in itxdata'reverse_range loop
225 write(oline, string'("?? unknown command: "));
227 writeline(output, oline);
228 report "aborting" severity failure;
232 report "failed to find command" severity failure;
242 idelta := idelta + 1;
243 exit when idelta>3000;
246 writetimestamp(oline, CLK_CYCLE, ": DONE ");
247 writeline(output, oline);
256 end process proc_stim;
260 variable oline : line;
264 wait until rising_edge(CLK);
268 writetimestamp(oline, CLK_CYCLE, ": moni ");
269 write(oline, string'(" FAIL MISSING ERR="));
271 write(oline, string'(" DATA="));
273 writeline(output, oline);
285 writetimestamp(oline, CLK_CYCLE, ": moni ");
286 write(oline, RXDATA, right, 10);
288 write(oline, string'(" RXERR=1"));
292 write(oline, string'(" FAIL UNEXPECTED"));
294 write(oline, string'(" CHECK"));
300 write(oline, string'(" OK"));
302 write(oline, string'(" FAIL"));
307 write(oline, string'(" OK"));
309 write(oline, string'(" FAIL, RXERR=1 expected"));
316 writeline(output, oline);
321 end process proc_moni;
OFFSET Delay_length := 200 ns
PERIOD Delay_length := 20 ns
std_logic_vector( 4 downto 0) slv5
std_logic_vector( 7 downto 0) slv8
slv5 := slv( to_unsigned( 15, 5) ) CLKDIV
slv8 :=( others => '0') R_MON_DAT_2
slv8 :=( others => '0') RXDATA
Delay_length := 200 ns clock_offset
Delay_length := 5 ns setup_time
slv8 :=( others => '0') N_MON_DAT
slv8 :=( others => '0') R_MON_DAT_1
Delay_length := 10 ns c2out_time
Delay_length := 20 ns clock_period