Professional Documents
Culture Documents
Asynchronous Fifo: Hierarchical Architecture
Asynchronous Fifo: Hierarchical Architecture
Hierarchical Architecture
Coding
Top level
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity async is
Port ( wclk:
in STD_LOGIC;
rclk:
in STD_LOGIC;
winc:
in STD_LOGIC;
rinc:
in STD_LOGIC;
wrst_n:
in STD_LOGIC;
rrst_n:
in STD_LOGIC;
wdata:
in STD_LOGIC_vector(7 downto 0);
rdata:
out STD_LOGIC_vector(7 downto 0);
almost_wfull: out STD_LOGIC;
almost_rempty: out STD_LOGIC);
end async;
architecture behaviraol1 of async is
component sync_r2wreg is
rptr:
end component;
component sync_w2rreg is
port( rq2_wptr: out std_logic_vector(4 downto 0);
wptr: in std_logic_vector(4 downto 0);
rclk: in std_logic;
rrst_n: in std_logic );
end component;
component dpram is
port ( wclk: in std_logic;
waddr: in std_logic_vector (3 downto 0);
raddr: in std_logic_vector (3 downto 0);
wdata: in std_logic_vector(7 downto 0);
rdata: out std_logic_vector(7 downto 0);
wclken: in std_logic;
wfull: in std_logic;
rclk: in std_logic;
rinc: in std_logic;
rempty: in std_logic);
end component;
component rptr_empty is
port (rclk: in std_logic;
raddr: out std_logic_vector (3 downto 0);
rptr: out std_logic_vector (4 downto 0);
rempty: out std_logic;
rq2_wptr: in std_logic_vector(4 downto 0);
rinc: in std_logic;
rrst_n: in std_logic);
end component;
component wptr_full is
port( wclk: in std_logic;
waddr: out std_logic_vector (3 downto 0);
wptr: out std_logic_vector (4 downto 0);
wfull: out std_logic;
wq2_rptr: in std_logic_vector(4 downto 0);
winc: in std_logic;
wrst_n: in std_logic);
end component;
signal waddr: std_logic_vector(3 downto 0);
signal raddr: std_logic_vector(3 downto 0);
signal wptr: std_logic_vector(4 downto 0);
signal rptr: std_logic_vector(4 downto 0);
signal wq2_rptr: std_logic_vector(4 downto 0);
signal rq2_wptr: std_logic_vector(4 downto 0);
signal wfull1: STD_LOGIC;
signal rempty1: STD_LOGIC;
begin
almost_wfull <= wfull1;
almost_rempty <= rempty1;
F1: dpram port map ( wclk,waddr,raddr,wdata,rdata,winc,wfull1,rclk,rinc,rempty1 );
F2: wptr_full port map ( wclk,waddr,wptr,wfull1,wq2_rptr,winc,wrst_n );
F3: rptr_empty port map ( rclk,raddr,rptr,rempty1,rq2_wptr,rinc,rrst_n );
F4: sync_r2wreg port map ( wq2_rptr,rptr,wclk,wrst_n );
F5: sync_w2rreg port map ( rq2_wptr,wptr,rclk,rrst_n );
end behaviraol1;
Toplevel architecture
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity dpram is
port ( wclk: in std_logic;
waddr: in std_logic_vector (3 downto 0);
raddr: in std_logic_vector (3 downto 0);
wdata: in std_logic_vector(7 downto 0);
rdata: out std_logic_vector(7 downto 0);
wclken: in std_logic;
wfull: in std_logic;
rclk: in std_logic;
rinc: in std_logic;
rempty: in std_logic);
end dpram;
architecture a_dpram of dpram is
type ram_array is array (0 to 15 ) of std_logic_vector(7 downto 0);
signal ram: ram_array ;
begin
write : process(wclk)
begin
if (wclk'event and wclk = '1') then
if ( wfull='0'and wclken='1') then
ram( conv_integer(waddr))<=wdata;
end if;
end if;
end process;
read:process(rclk)
begin
if (rclk='1' and rclk'event) then
if (rinc = '1' and rempty ='0') then
rdata<=ram(conv_integer(raddr));
end if;
end if;
end process;
end a_dpram;
Empty Logic
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity rptr_empty is
port
(rclk: in std_logic;
raddr: out std_logic_vector (3 downto 0);
rptr: out std_logic_vector (4 downto 0);
rempty: out std_logic;
rq2_wptr: in std_logic_vector(4 downto 0);
rinc: in std_logic;
rrst_n: in std_logic);
end rptr_empty;
architecture behaviraol of rptr_empty is
signal rbin:
std_logic_vector (4 downto 0);
signal rbinnext: std_logic_vector (4 downto 0);
signal rgraynext: std_logic_vector (4 downto 0);
signal r_empty: std_logic;
signal r_empty1: std_logic;
begin
process(rclk,rrst_n)
begin
if(rclk'event and rclk='1') then
if(rrst_n='1') then
rbin<=(others=>'0');
rptr<=(others=>'0');
else
rbin<=rbinnext;
rptr<=rgraynext;
end if;
end if;
end process;
------ Gray counter--------rbinnext <= rbin + (rinc and (not r_empty1));
rgraynext <= ('0' & rbinnext(4 downto 1)) xor (rbinnext);
---Memory address counter ----------
end behaviraol;
Full Logic
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity wptr_full is
port( wclk:
in std_logic;
process(wrst_n,wclk)
begin
if(wclk'event and wclk='1') then
if (wrst_n='1') then
w_full1<='0';
else
w_full1<=w_full;
end if;
end if;
end process;
wfull<=w_full1;
end behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity sync_w2rreg is
port( rq2_wptr: out std_logic_vector(4 downto 0);
wptr: in std_logic_vector(4 downto 0);
rclk: in std_logic;
rrst_n: in std_logic );
end sync_w2rreg;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity sync_r2wreg is
port( wq2_rptr: out std_logic_vector(4 downto 0);
rptr: in std_logic_vector(4 downto 0);
wclk: in std_logic;
wrst_n: in std_logic );
end sync_r2wreg;
Synthesis report
Release 7.1i - xst H.38
Copyright (c) 1995-2005 Xilinx, Inc. All rights reserved.
--> Parameter TMPDIR set to __projnav
CPU : 0.00 / 0.33 s | Elapsed : 0.00 / 1.00 s
--> Parameter xsthdpdir set to ./xst
CPU : 0.00 / 0.33 s | Elapsed : 0.00 / 1.00 s
--> Reading design: async.prj
TABLE OF CONTENTS
1) Synthesis Options Summary
2) HDL Compilation
3) HDL Analysis
4) HDL Synthesis
5) Advanced HDL Synthesis
5.1) HDL Synthesis Report
6) Low Level Synthesis
7) Final Report
7.1) Device utilization summary
7.2) TIMING REPORT
===============================================================
==========
*
Synthesis Options Summary
*
===============================================================
==========
---- Source Parameters
Input File Name
: "async.prj"
Input Format
: mixed
Ignore Synthesis Constraint File : NO
---- Target Parameters
Output File Name
Output Format
Target Device
: "async"
: NGC
: xc2s50-5-pq208
: YES
inferred 1 Adder/Subtractor(s).
inferred 1 Comparator(s).
Unit <wptr_full> synthesized.
Synthesizing Unit <dpram>.
Related source file is "D:/async_fifo/dpram.vhd".
Found 16x8-bit dual-port block RAM for signal <ram>.
----------------------------------------------------------------------| mode
| write-first
|
|
| aspect ratio
| 16-word x 8-bit
|
|
| clock
| connected to signal <wclk>
| rise |
| dual clock
| connected to signal <rclk>
| rise |
| dual enable
| connected to internal node
| high |
| write enable
| connected to internal node
| high |
| address
| connected to signal <waddr>
|
|
| dual address
| connected to signal <raddr>
|
|
| data in
| connected to signal <wdata>
|
|
| data out
| not connected
|
|
| dual data out | connected to signal <rdata>
|
|
| ram_style
| Auto
|
|
----------------------------------------------------------------------Summary:
inferred 1 RAM(s).
Unit <dpram> synthesized.
Synthesizing Unit <async>.
Related source file is "D:/async_fifo/async_fif0.vhd".
Unit <async> synthesized.
===============================================================
==========
*
Advanced HDL Synthesis
*
===============================================================
==========
Advanced RAM inference ...
Advanced multiplier inference ...
Advanced Registered AddSub inference ...
Dynamic shift register inference ...
===============================================================
==========
HDL Synthesis Report
Macro Statistics
# Block RAMs
:1
16x8-bit dual-port block RAM
:1
# Adders/Subtractors
:2
5-bit adder
:2
# Registers
: 10
1-bit register
:2
5-bit register
:8
# Comparators
:2
5-bit comparator equal
:2
# Xors
:8
1-bit xor2
:8
===============================================================
==========
===============================================================
==========
*
Low Level Synthesis
*
===============================================================
==========
Register <wbin_4> equivalent to <wptr_4> has been removed
Register <rbin_4> equivalent to <rptr_4> has been removed
Optimizing unit <async> ...
Optimizing unit <wptr_full> ...
Optimizing unit <rptr_empty> ...
Loading device for application Rf_Device from file 'v50.nph' in environment D:/Xilinx.
Mapping all equations...
Building and optimizing final netlist ...
Found area constraint ratio of 100 (+ 5) on block async, actual ratio is 3.
===============================================================
==========
*
Final Report
*
===============================================================
==========
Final Results
RTL Top Level Output File Name : async.ngr
Top Level Output File Name
: async
Output Format
: NGC
Optimization Goal
: Speed
Keep Hierarchy
Design Statistics
# IOs
: NO
: 24
Macro Statistics :
# RAM
:1
#
16x8-bit dual-port block RAM: 1
# Registers
: 10
#
1-bit register
:2
#
5-bit register
:8
# Adders/Subtractors
:2
#
5-bit adder
:2
# Comparators
:2
#
5-bit comparator equal
:2
Cell Usage :
# BELS
: 48
#
GND
:1
#
LUT1_L
:8
#
LUT2
:4
#
LUT2_D
:2
#
LUT2_L
:4
#
LUT3_D
:2
#
LUT4
:2
#
LUT4_L
:8
#
MUXCY
:8
#
VCC
:1
#
XORCY
:8
# FlipFlops/Latches
: 40
#
FDR
: 39
#
FDS
:1
# RAMS
:1
#
RAMB4_S16_S16
:1
# Clock Buffers
:2
#
BUFGP
:2
# IO Buffers
: 22
#
IBUF
: 12
#
OBUF
: 10
===============================================================
==========
Device utilization summary:
--------------------------Selected Device : 2s50pq208-5
Number of Slices:
Number of Slice Flip Flops:
Number of 4 input LUTs:
Number of bonded IOBs:
Number of BRAMs:
Number of GCLKs:
31 out of 768 4%
40 out of 1536 2%
30 out of 1536 1%
24 out of 144 16%
1 out of
8 12%
2 out of
4 50%
===============================================================
==========
TIMING REPORT
NOTE: THESE TIMING NUMBERS ARE ONLY A SYNTHESIS ESTIMATE.
FOR ACCURATE TIMING INFORMATION PLEASE REFER TO THE TRACE
REPORT
GENERATED AFTER PLACE-and-ROUTE.
Clock Information:
----------------------------------------------------+------------------------+-------+
Clock Signal
| Clock buffer(FF name) | Load |
-----------------------------------+------------------------+-------+
rclk
| BUFGP
| 21 |
wclk
| BUFGP
| 21 |
-----------------------------------+------------------------+-------+
Timing Summary:
--------------Speed Grade: -5
Minimum period: 10.671ns (Maximum Frequency: 93.712MHz)
Minimum input arrival time before clock: 10.163ns
Maximum output required time after clock: 10.481ns
Maximum combinational path delay: No path found
Timing Detail:
-------------All values displayed in nanoseconds (ns)
===============================================================
==========
Timing constraint: Default period analysis for Clock 'rclk'
Clock period: 10.671ns (frequency: 93.712MHz)
Total number of paths / destination ports: 119 / 20
-------------------------------------------------------------------------
Delay:
10.671ns (Levels of Logic = 6)
Source:
F3/r_empty1 (FF)
Destination:
F3/r_empty1 (FF)
Source Clock: rclk rising
Destination Clock: rclk rising
Data Path: F3/r_empty1 to F3/r_empty1
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- -----------FDS:C->Q
5 1.292 1.740 F3/r_empty1 (F3/r_empty1)
LUT3_D:I2->LO
1 0.653 0.000 F3/rptr_empty_rbinnext<0>lut (N155)
MUXCY:S->O
1 0.784 0.000 F3/rptr_empty_rbinnext<0>cy
(F3/rptr_empty_rbinnext<0>_cyo)
XORCY:CI->O
5 0.500 1.740 F3/rptr_empty_rbinnext<1>_xor
(F3/rbinnext<1>)
LUT2:I0->O
1 0.653 1.150 F3/r_empty378_SW0_SW0 (N150)
LUT4_L:I1->LO
1 0.653 0.100 F3/r_empty378_SW0 (N142)
LUT4_L:I3->LO
1 0.653 0.000 F3/r_empty378 (F3/r_empty)
FDS:D
0.753
F3/r_empty1
---------------------------------------Total
10.671ns (5.941ns logic, 4.730ns route)
(55.7% logic, 44.3% route)
===============================================================
==========
Timing constraint: Default period analysis for Clock 'wclk'
Clock period: 10.671ns (frequency: 93.712MHz)
Total number of paths / destination ports: 119 / 20
------------------------------------------------------------------------Delay:
10.671ns (Levels of Logic = 6)
Source:
F2/w_full1 (FF)
Destination:
F2/w_full1 (FF)
Source Clock: wclk rising
Destination Clock: wclk rising
Data Path: F2/w_full1 to F2/w_full1
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- -----------FDR:C->Q
5 1.292 1.740 F2/w_full1 (F2/w_full1)
LUT3_D:I2->LO
1 0.653 0.000 F2/wptr_full_wbinnext<0>lut (N154)
MUXCY:S->O
1 0.784 0.000 F2/wptr_full_wbinnext<0>cy
(F2/wptr_full_wbinnext<0>_cyo)
XORCY:CI->O
5 0.500 1.740 F2/wptr_full_wbinnext<1>_xor
(F2/wbinnext<1>)
LUT2:I0->O
1 0.653 1.150 F2/w_full385_SW0_SW0 (N148)
LUT4_L:I3->LO
1 0.653 0.100 F2/w_full385_SW0 (N140)
LUT4_L:I3->LO
1 0.653 0.000 F2/w_full385 (F2/w_full)
FDR:D
0.753
F2/w_full1
---------------------------------------Total
10.671ns (5.941ns logic, 4.730ns route)
(55.7% logic, 44.3% route)
===============================================================
==========
Timing constraint: Default OFFSET IN BEFORE for Clock 'rclk'
Total number of paths / destination ports: 42 / 31
------------------------------------------------------------------------Offset:
10.163ns (Levels of Logic = 7)
Source:
rinc (PAD)
Destination:
F3/r_empty1 (FF)
Destination Clock: rclk rising
Data Path: rinc to F3/r_empty1
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- -----------IBUF:I->O
4 0.924 1.600 rinc_IBUF (rinc_IBUF)
LUT3_D:I1->LO
1 0.653 0.000 F3/rptr_empty_rbinnext<0>lut (N155)
MUXCY:S->O
1 0.784 0.000 F3/rptr_empty_rbinnext<0>cy
(F3/rptr_empty_rbinnext<0>_cyo)
XORCY:CI->O
5 0.500 1.740 F3/rptr_empty_rbinnext<1>_xor
(F3/rbinnext<1>)
LUT2:I0->O
1 0.653 1.150 F3/r_empty378_SW0_SW0 (N150)
LUT4_L:I1->LO
1 0.653 0.100 F3/r_empty378_SW0 (N142)
LUT4_L:I3->LO
1 0.653 0.000 F3/r_empty378 (F3/r_empty)
FDS:D
0.753
F3/r_empty1
---------------------------------------Total
10.163ns (5.573ns logic, 4.590ns route)
(54.8% logic, 45.2% route)
===============================================================
==========
Timing constraint: Default OFFSET IN BEFORE for Clock 'wclk'
Total number of paths / destination ports: 50 / 39
------------------------------------------------------------------------Offset:
10.163ns (Levels of Logic = 7)
Source:
winc (PAD)
Destination:
F2/w_full1 (FF)
Destination Clock: wclk rising
Destination:
almost_wfull (PAD)
Source Clock: wclk rising
Data Path: F2/w_full1 to almost_wfull
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- -----------FDR:C->Q
5 1.292 1.740 F2/w_full1 (F2/w_full1)
OBUF:I->O
5.557
almost_wfull_OBUF (almost_wfull)
---------------------------------------Total
8.589ns (6.849ns logic, 1.740ns route)
(79.7% logic, 20.3% route)
===============================================================
==========
CPU : 9.89 / 10.25 s | Elapsed : 10.00 / 11.00 s
-->
Total memory usage is 84320 kilobytes
Number of errors : 0 ( 0 filtered)
Number of warnings : 0 ( 0 filtered)
Number of infos : 0 ( 0 filtered)