Line 1... |
Line 1... |
-- $Id: simlib.vhd 346 2010-12-22 22:59:26Z mueller $
|
-- $Id: simlib.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2006-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2006-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
--
|
--
|
-- This program is free software; you may redistribute and/or modify it under
|
-- This program is free software; you may redistribute and/or modify it under
|
-- the terms of the GNU General Public License as published by the Free
|
-- the terms of the GNU General Public License as published by the Free
|
-- Software Foundation, either version 2, or at your option any later version.
|
-- Software Foundation, either version 2, or at your option any later version.
|
--
|
--
|
Line 16... |
Line 16... |
-- Description: Support routines for test benches
|
-- Description: Support routines for test benches
|
--
|
--
|
-- Dependencies: -
|
-- Dependencies: -
|
-- Test bench: -
|
-- Test bench: -
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2, 12.1; ghdl 0.18-0.29
|
-- Tool versions: xst 8.2, 9.1, 9.2, 12.1, 13.1; ghdl 0.18-0.29
|
--
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-18 427 1.3.8 now numeric_std clean
|
-- 2010-12-22 346 1.3.7 rename readcommand -> readdotcomm
|
-- 2010-12-22 346 1.3.7 rename readcommand -> readdotcomm
|
-- 2010-11-13 338 1.3.6 add simclkcnt; xx.x ns time in writetimestamp()
|
-- 2010-11-13 338 1.3.6 add simclkcnt; xx.x ns time in writetimestamp()
|
-- 2008-03-24 129 1.3.5 CLK_CYCLE now 31 bits
|
-- 2008-03-24 129 1.3.5 CLK_CYCLE now 31 bits
|
-- 2008-03-02 121 1.3.4 added readempty (to discard rest of line)
|
-- 2008-03-02 121 1.3.4 added readempty (to discard rest of line)
|
-- 2007-12-27 106 1.3.3 added simclk2v
|
-- 2007-12-27 106 1.3.3 added simclk2v
|
Line 41... |
Line 42... |
-- 2007-06-14 56 1.0 Initial version (renamed from pdp11_sim.vhd)
|
-- 2007-06-14 56 1.0 Initial version (renamed from pdp11_sim.vhd)
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.numeric_std.all;
|
use ieee.std_logic_textio.all;
|
use ieee.std_logic_textio.all;
|
use std.textio.all;
|
use std.textio.all;
|
|
|
use work.slvtypes.all;
|
use work.slvtypes.all;
|
|
|
Line 428... |
Line 429... |
when 2 => read(L, value, ok);
|
when 2 => read(L, value, ok);
|
when 8 => readoct(L, value, ok);
|
when 8 => readoct(L, value, ok);
|
when 16 => readhex(L, value, ok);
|
when 16 => readhex(L, value, ok);
|
when 10 =>
|
when 10 =>
|
read(L, ivalue, ok);
|
read(L, ivalue, ok);
|
value := conv_std_logic_vector(ivalue, value'length);
|
-- the following if allows to enter negative integers, e.g. -1 for all-1
|
|
if ivalue >= 0 then
|
|
value := slv(to_unsigned(ivalue, value'length));
|
|
else
|
|
value := slv(to_signed(ivalue, value'length));
|
|
end if;
|
when others => null;
|
when others => null;
|
end case;
|
end case;
|
end if;
|
end if;
|
|
|
if ok and lbase/=0 then
|
if ok and lbase/=0 then
|
Line 953... |
Line 959... |
when '-' => ochar := '-';
|
when '-' => ochar := '-';
|
when others => null;
|
when others => null;
|
end case;
|
end case;
|
end loop; -- i
|
end loop; -- i
|
if ochar = ' ' then
|
if ochar = ' ' then
|
write(L,conv_integer(unsigned(nibble)));
|
write(L,to_integer(unsigned(nibble)));
|
else
|
else
|
write(L,ochar);
|
write(L,ochar);
|
end if;
|
end if;
|
iwidth := 3;
|
iwidth := 3;
|
ioffset := ioffset - 3;
|
ioffset := ioffset - 3;
|
Line 1015... |
Line 1021... |
when '-' => ochar := '-';
|
when '-' => ochar := '-';
|
when others => null;
|
when others => null;
|
end case;
|
end case;
|
end loop; -- i
|
end loop; -- i
|
if ochar = ' ' then
|
if ochar = ' ' then
|
write(L,hextab(conv_integer(unsigned(nibble))+1));
|
write(L,hextab(to_integer(unsigned(nibble))+1));
|
else
|
else
|
write(L,ochar);
|
write(L,ochar);
|
end if;
|
end if;
|
iwidth := 4;
|
iwidth := 4;
|
ioffset := ioffset - 4;
|
ioffset := ioffset - 4;
|
Line 1073... |
Line 1079... |
write(L, t_nsec, right, 8);
|
write(L, t_nsec, right, 8);
|
write(L,'.');
|
write(L,'.');
|
write(L, t_dnsec, right, 1);
|
write(L, t_dnsec, right, 1);
|
write(L, string'(" ns"));
|
write(L, string'(" ns"));
|
|
|
write(L, conv_integer(unsigned(clkcyc)), right, 7);
|
write(L, to_integer(unsigned(clkcyc)), right, 7);
|
if str /= null_string then
|
if str /= null_string then
|
write(L, str);
|
write(L, str);
|
end if;
|
end if;
|
|
|
end procedure writetimestamp;
|
end procedure writetimestamp;
|