Line 1... |
Line 1... |
-- $Id: rbd_timer.vhd 351 2010-12-30 21:50:54Z mueller $
|
-- $Id: rbd_timer.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2010- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2010-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 18... |
Line 18... |
-- Dependencies: -
|
-- Dependencies: -
|
--
|
--
|
-- Test bench: -
|
-- Test bench: -
|
--
|
--
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 12.1; ghdl 0.29
|
-- Tool versions: xst 12.1, 13.1; ghdl 0.29
|
--
|
--
|
-- Synthesized (xst):
|
-- Synthesized (xst):
|
-- Date Rev ise Target flop lutl lutm slic t peri
|
-- Date Rev ise Target flop lutl lutm slic t peri
|
-- 2010-12-29 351 12.1 M53d xc3s1000-4 19 63 - 34 s 7.6
|
-- 2010-12-29 351 12.1 M53d xc3s1000-4 19 63 - 34 s 7.6
|
--
|
--
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-19 427 1.0.1 now numeric_std clean
|
-- 2010-12-29 351 1.0 Initial version
|
-- 2010-12-29 351 1.0 Initial version
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
--
|
--
|
-- rbus registers:
|
-- rbus registers:
|
--
|
--
|
Line 38... |
Line 39... |
-- w: if > 0 timer is running
|
-- w: if > 0 timer is running
|
--
|
--
|
|
|
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 work.slvtypes.all;
|
use work.slvtypes.all;
|
use work.rblib.all;
|
use work.rblib.all;
|
|
|
entity rbd_timer is -- rbus dev: usec precision timer
|
entity rbd_timer is -- rbus dev: usec precision timer
|
generic (
|
generic (
|
RB_ADDR : slv8 := conv_std_logic_vector(2#00000000#,8));
|
RB_ADDR : slv8 := slv(to_unsigned(2#00000000#,8)));
|
port (
|
port (
|
CLK : in slbit; -- clock
|
CLK : in slbit; -- clock
|
CE_USEC : in slbit; -- usec pulse
|
CE_USEC : in slbit; -- usec pulse
|
RESET : in slbit; -- reset
|
RESET : in slbit; -- reset
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
Line 80... |
Line 81... |
|
|
begin
|
begin
|
|
|
proc_regs: process (CLK)
|
proc_regs: process (CLK)
|
begin
|
begin
|
if CLK'event and CLK='1' then
|
if rising_edge(CLK) then
|
if RESET = '1' then
|
if RESET = '1' then
|
R_REGS <= regs_init;
|
R_REGS <= regs_init;
|
else
|
else
|
R_REGS <= N_REGS;
|
R_REGS <= N_REGS;
|
end if;
|
end if;
|
Line 130... |
Line 131... |
if r.timer_act = '1' then -- if timer active
|
if r.timer_act = '1' then -- if timer active
|
if unsigned(r.timer) = 0 then -- if timer at end
|
if unsigned(r.timer) = 0 then -- if timer at end
|
n.timer_act := '0'; -- mark unactive
|
n.timer_act := '0'; -- mark unactive
|
n.timer_end := '1'; -- send end marker
|
n.timer_end := '1'; -- send end marker
|
else -- else: timer not at end
|
else -- else: timer not at end
|
n.timer := unsigned(r.timer) - 1; -- decrement
|
n.timer := slv(unsigned(r.timer) - 1); -- decrement
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
N_REGS <= n;
|
N_REGS <= n;
|