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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [speed/] [flipflop.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY IEEE;
21
USE IEEE.STD_LOGIC_1164.ALL;
22
USE IEEE.numeric_std.ALL;
23
 
24
ENTITY flipflop IS
25
  PORT (clock : IN  STD_LOGIC;
26
        sig   : OUT STD_LOGIC);
27
END flipflop;
28
 
29
ARCHITECTURE Behavioral OF flipflop IS
30
 
31
  SIGNAL count  : NATURAL RANGE 0 TO 63 := 0;
32
  SIGNAL result : STD_LOGIC_VECTOR(5 DOWNTO 0);
33
 
34
BEGIN
35
 
36
  PROCESS (clock)
37
  BEGIN  -- PROCESS
38
    IF rising_edge(clock) THEN
39
 
40
      IF count = 63 THEN
41
        count <= 0;
42
      ELSE
43
        count <= count + 1;
44
      END IF;
45
 
46
    END IF;
47
  END PROCESS;
48
 
49
  result <= STD_LOGIC_VECTOR(to_unsigned(count, 6));
50
 
51
  sig <= result(5);
52
 
53
END Behavioral;
54
 

powered by: WebSVN 2.1.0

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