URL
https://opencores.org/ocsvn/cfft/cfft/trunk
[/] [cfft/] [trunk/] [src/] [div4limit.vhd] - Blame information for rev 14
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
2 |
sradio |
---------------------------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- Title : div4limit
|
4 |
|
|
-- Design : cfft
|
5 |
|
|
-- Author : ZHAO Ming
|
6 |
|
|
-- email : sradio@opencores.org
|
7 |
|
|
--
|
8 |
|
|
---------------------------------------------------------------------------------------------------
|
9 |
|
|
--
|
10 |
|
|
-- File : div4limit.vhd
|
11 |
|
|
-- Generated : Tue Jul 16 10:39:17 2002
|
12 |
|
|
--
|
13 |
|
|
---------------------------------------------------------------------------------------------------
|
14 |
|
|
--
|
15 |
|
|
-- Description : Div 4 Limit to 12 bit
|
16 |
|
|
--
|
17 |
|
|
---------------------------------------------------------------------------------------------------
|
18 |
|
|
--
|
19 |
|
|
-- Revisions : 0
|
20 |
|
|
-- Revision Number : 1
|
21 |
|
|
-- Version : 1
|
22 |
|
|
-- Date : Oct 17 2002
|
23 |
|
|
-- Modifier : ZHAO Ming
|
24 |
|
|
-- Desccription : Data width configurable
|
25 |
|
|
--
|
26 |
|
|
---------------------------------------------------------------------------------------------------
|
27 |
|
|
|
28 |
|
|
library IEEE;
|
29 |
|
|
use IEEE.STD_LOGIC_1164.all;
|
30 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.all;
|
31 |
|
|
|
32 |
|
|
entity div4limit is
|
33 |
|
|
generic (
|
34 |
|
|
WIDTH : Natural
|
35 |
|
|
);
|
36 |
|
|
port(
|
37 |
|
|
clk : in std_logic;
|
38 |
|
|
D : in STD_LOGIC_VECTOR(WIDTH+3 downto 0);
|
39 |
|
|
Q : out STD_LOGIC_VECTOR(WIDTH-1 downto 0)
|
40 |
|
|
);
|
41 |
|
|
end div4limit;
|
42 |
|
|
|
43 |
|
|
architecture div4limit of div4limit is
|
44 |
|
|
begin
|
45 |
|
|
|
46 |
|
|
process( clk )
|
47 |
|
|
variable Temp_D:std_logic_vector( WIDTH+1 downto 0 );
|
48 |
|
|
begin
|
49 |
|
|
if clk'event and clk='1' then
|
50 |
|
|
Temp_D:=D( WIDTH+3 downto 2 )+D(1);
|
51 |
|
|
if Temp_D(WIDTH+1)='1' and Temp_D(WIDTH downto WIDTH-1)/="11" then
|
52 |
|
|
Temp_D(WIDTH+1 downto WIDTH-1):="111";
|
53 |
|
|
Temp_D(WIDTH-2 downto 1):=( others=>'0' );
|
54 |
|
|
Temp_D(0):='1';
|
55 |
|
|
elsif Temp_D(WIDTH+1)='0' and Temp_D(WIDTH downto WIDTH-1)/="00" then
|
56 |
|
|
Temp_D(WIDTH+1 downto WIDTH-1):="000";
|
57 |
|
|
Temp_D(WIDTH-2 downto 0):=( others=>'1' );
|
58 |
|
|
end if;
|
59 |
|
|
Q<=Temp_D(WIDTH-1 downto 0 );
|
60 |
|
|
end if;
|
61 |
|
|
end process;
|
62 |
|
|
|
63 |
|
|
end div4limit;
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.