OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [genlib/] [led_pulse_stretch.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
-- $Id: led_pulse_stretch.vhd 466 2012-12-30 13:26:55Z mueller $
2
--
3
-- Copyright 2012- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
-- 
14
------------------------------------------------------------------------------
15
-- Module Name:    led_pulse_stretch - syn
16
-- Description:    pulse stretcher for leds
17
--
18
-- Dependencies:   -
19
-- Test bench:     -
20
-- Target Devices: generic
21
-- Tool versions:  xst 13.3; ghdl 0.29
22
-- Revision History: 
23
-- Date         Rev Version  Comment
24
-- 2012-12-29   466   1.0    Initial version 
25
------------------------------------------------------------------------------
26
 
27
library ieee;
28
use ieee.std_logic_1164.all;
29
use ieee.numeric_std.all;
30
 
31
use work.slvtypes.all;
32
 
33
entity led_pulse_stretch is             -- pulse stretcher for leds
34
  port (
35
    CLK : in slbit;                     -- clock
36
    CE_INT : in slbit;                  -- pulse time unit clock enable
37
    RESET : in slbit := '0';            -- reset
38
    DIN : in slbit;                     -- data in
39
    POUT : out slbit                    -- pulse out
40
  );
41
end entity led_pulse_stretch;
42
 
43
architecture syn of led_pulse_stretch is
44
 
45
  type regs_type is record              -- state registers
46
    seen : slbit;                       -- DIN seen
47
    busy : slbit;                       -- POUT busy
48
  end record regs_type;
49
 
50
  constant regs_init : regs_type := (
51
    '0',                                -- seen
52
    '0'                                 -- busy
53
  );
54
 
55
  signal R_REGS : regs_type := regs_init;  -- state registers
56
  signal N_REGS : regs_type := regs_init;  -- next value state regs
57
 
58
begin
59
 
60
  proc_regs: process (CLK)
61
  begin
62
 
63
    if rising_edge(CLK) then
64
      if RESET = '1' then
65
        R_REGS <= regs_init;
66
      else
67
        R_REGS <= N_REGS;
68
      end if;
69
    end if;
70
 
71
  end process proc_regs;
72
 
73
  proc_next: process (R_REGS, CE_INT, DIN)
74
    variable r : regs_type := regs_init;
75
    variable n : regs_type := regs_init;
76
 
77
  begin
78
 
79
    r := R_REGS;
80
    n := R_REGS;
81
 
82
    if CE_INT='1' then
83
      n.seen := DIN;
84
      n.busy := r.seen;
85
    else
86
      if DIN='1' then
87
        n.seen := '1';
88
      end if;
89
    end if;
90
 
91
    N_REGS <= n;
92
 
93
    POUT   <= r.busy;
94
 
95
  end process proc_next;
96
 
97
end syn;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.