URL
https://opencores.org/ocsvn/lateq/lateq/trunk
Subversion Repositories lateq
[/] [lateq/] [trunk/] [hdl_single_type/] [src/] [lateq_pkg.vhd] - Rev 2
Compare with Previous | Blame | View Log
------------------------------------------------------------------------------- -- Title : Versatile latency checker/equalizer for pipelines -- : package with types and functions definitions -- Project : ------------------------------------------------------------------------------- -- File : lateq.vhd -- Author : Wojciech M. Zabolotny ( wzab01<at>gmail.com ) -- Company : -- License : BSD -- Created : 2013-11-01 -- Standard : VHDL'93/02 -- Libraries used library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use std.textio.all; library work; package lateq_pkg is -- pragma translate_off file f_lat_rep : text is out "/tmp/latrep.txt"; file f_leq_mode : text is in "/tmp/lateq_mode.txt"; -- Function reading the simulation mode function lateq_mode_read return integer; constant C_LATEQ_MODE : integer := lateq_mode_read; subtype T_LATEQ_MRK is integer; constant C_LATEQ_MRK_INIT : integer := -1; -- Function reporting the delay for analyzis procedure lateq_report_delay ( constant s1 : string; constant i1, i2 : in integer); -- Function marking the end of reports from single block procedure lateq_report_end ( constant s1 : string); -- Function for comparison of time markers function lateq_mrk_cmp ( constant v1, v2 : T_LATEQ_MRK) return integer; -- Function converting time marker to string (for reports) function lateq_mrk_to_str ( constant v1 : T_LATEQ_MRK) return string; -- Function incrementing the time marker function lateq_mrk_incr ( constant v1 : T_LATEQ_MRK) return T_LATEQ_MRK; -- pragma translate_on end package lateq_pkg; package body lateq_pkg is -- pragma translate_off function lateq_mode_read return integer is variable rl : line; variable res : integer; begin readline(f_leq_mode,rl); read(rl,res); return res; end function lateq_mode_read; function lateq_mrk_cmp ( constant v1, v2 : T_LATEQ_MRK) return integer is variable res : integer; begin -- function "-" res := v1-v2; return res; end function lateq_mrk_cmp; function lateq_mrk_incr ( constant v1 : T_LATEQ_MRK) return T_LATEQ_MRK is variable res : T_LATEQ_MRK; begin -- function "-" res := v1+1; return res; end function lateq_mrk_incr; procedure lateq_report_delay ( constant s1 : string; constant i1, i2 : in integer) is variable wl : line; begin write(wl, s1 & string'(",")); write(wl, integer'image(i1)); write(wl, string'(",")); write(wl, integer'image(i2)); writeline(f_lat_rep, wl); end procedure lateq_report_delay; procedure lateq_report_end ( constant s1 : string) is variable wl : line; begin write(wl, s1 & string'(",end")); writeline(f_lat_rep, wl); end procedure lateq_report_end; function lateq_mrk_to_str ( constant v1 : T_LATEQ_MRK) return string is begin return integer'image(v1); end function lateq_mrk_to_str; -- pragma translate_on end package body lateq_pkg;