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

Subversion Repositories pcounter

[/] [pcounter/] [trunk/] [pdivtwo.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robotron
--
2
-- * pipelined synchronous pulse counter *
3
--  pdivtwo -- core 1-stage element (pipelined f/2 divider)
4
--
5
-- fast counter for slow-carry architectures
6
-- non-monotonic counting, value calculable by HDL/CPU
7
--
8
-- idea&code by Marek Peca <mp@duch.cz> 08/2012
9
-- Vyzkumny a zkusebni letecky ustav, a.s. http://vzlu.cz/
10
-- thanks to Michael Vacek <michael.vacek@vzlu.cz> for testing
11
--
12
 
13
library ieee;
14
use ieee.std_logic_1164.all;
15
use ieee.numeric_std.all;
16
 
17
entity pdivtwo is
18
  port (
19
    clock: in std_logic;
20
    en: in std_logic;
21
    q, p: out std_logic
22
  );
23
end pdivtwo;
24
 
25
architecture behavioral of pdivtwo is
26
  signal state: std_logic := '1';
27
  signal pipe: std_logic := '0';
28
  signal next_state, next_pipe: std_logic;
29
begin
30
  next_state <= not state when en = '1' else state;
31
  next_pipe <= state and en;
32
  p <= pipe;
33
  q <= state;
34
 
35
  process
36
  begin
37
    wait until clock'event and clock = '1';
38
    state <= next_state;
39
    pipe <= next_pipe;
40
  end process;
41
end behavioral;

powered by: WebSVN 2.1.0

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