Skip to content

Commit

Permalink
Merge pull request #3 from mherlev/master
Browse files Browse the repository at this point in the history
OCP clock domain crossing
  • Loading branch information
schoeberl committed Apr 25, 2016
2 parents ef0c7d6 + 54d96e5 commit 761ae63
Show file tree
Hide file tree
Showing 10 changed files with 1,303 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,33 @@ transcript
work/
sched.xml
.prj
*.dbg
*.dbg

#VIM
*.swp

#OS X
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
Expand Down
66 changes: 66 additions & 0 deletions src/cdc/common/OCPBurstClockCrossingInterface_types.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--------------------------------------------------------------------------------
-- Copyright (c) 2016, Mathias Herlev
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
-- Title : OCPBurst Interface Types
-- Type : Type Package
-- Description : Record types for OCPburst CDC interface
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY work;
USE work.ocp.all;

PACKAGE OCPBurstCDC_types IS

TYPE OCPBurstCDCIn_r IS
RECORD
clk_A : std_logic;
rst_A : std_logic;
clk_B : std_logic;
rst_B : std_logic;
OCPB_slave : ocp_burst_s;
OCPB_master : ocp_burst_m;
END RECORD;

TYPE OCPBurstCDCOut_r IS
RECORD
OCPB_A : ocp_burst_s;
OCPB_B : ocp_burst_m;
END RECORD;

TYPE AsyncBurst_A_r IS
RECORD
req : std_logic;
Data : ocp_burst_m;
RegAddr : std_logic_vector(1 downto 0);
END RECORD;

TYPE AsyncBurst_B_r IS
RECORD
ack : std_logic;
Data : ocp_burst_s;
RegAddr : std_logic_vector(1 downto 0);
END RECORD;
END OCPBurstCDC_types;
65 changes: 65 additions & 0 deletions src/cdc/common/OCPIOClockCrossingInterface_types.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
--------------------------------------------------------------------------------
-- Copyright (c) 2016, Mathias Herlev
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
-- Title : OCPBurst Interface Types
-- Type : Type Package
-- Description : Record types for OCPio CDC interface
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY work;
USE work.ocp.all;
PACKAGE OCPIOCDC_types IS

TYPE OCPIOCDCIn_r IS
RECORD
clk_A : std_logic;
rst_A : std_logic;
clk_B : std_logic;
rst_B : std_logic;
ocpio_B : ocp_io_s;
ocpio_A : ocp_io_m;
END RECORD;

TYPE OCPIOCDCOut_r IS
RECORD
ocpio_A : ocp_io_s;
ocpio_B : ocp_io_m;
END RECORD;

TYPE asyncIO_A_r IS
RECORD
req : std_logic;
data : ocp_io_m;
END RECORD;

TYPE asyncIO_B_r IS
RECORD
ack : std_logic;
data : ocp_io_s;
END RECORD;


END OCPIOCDC_types;
47 changes: 47 additions & 0 deletions src/cdc/common/OCPInterface.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--------------------------------------------------------------------------------
-- Copyright (c) 2016, Mathias Herlev
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
-- Title : OCPBurst Interface Types
-- Type : Type Package
-- Description : Idle constants
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY work;
USE work.ocp.all;


PACKAGE OCPInterface IS

CONSTANT OCPBurstMasterIdle_c : ocp_burst_m := (OCP_CMD_IDLE,
(OTHERS => '0'),
(OTHERS => '0'),
(OTHERS => '0'),

CONSTANT OCPBurstSlaveIdle_c : ocp_burst_s := (OCP_RESP_NULL,
(OTHERS => '0'),
'0',
'0');
END OCPInterface;
84 changes: 84 additions & 0 deletions src/cdc/ocpburst/ocpburst_cdc.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
--------------------------------------------------------------------------------
-- Copyright (c) 2016, Mathias Herlev
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- 2. Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
-- Title : OCPBurst Clock Crossing Interface
-- Type : Entity
-- Description : OCPburst CDC wrapper
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY work;
USE work.OCPBurstCDC_types.all;
USE work.ocp.all;
ENTITY OCPBurstCDC IS
PORT( input : IN OCPBurstCDCIn_r;
output : OUT OCPBurstCDCOut_r
);
END ENTITY OCPBurstCDC;

ARCHITECTURE rtl OF OCPBurstCDC IS

COMPONENT OCPBurstCDC_A IS
PORT( clk : IN std_logic;
rst : IN std_logic;
syncIn : IN ocp_burst_m;
syncOut : OUT ocp_burst_s;
asyncOut : OUT AsyncBurst_A_r;
asyncIn : IN AsyncBurst_B_r
);
END COMPONENT OCPBurstCDC_A;

COMPONENT OCPBurstCDC_B IS
PORT( clk : IN std_logic;
rst : IN std_logic;
syncIn : IN ocp_burst_s;
syncOut : OUT ocp_burst_m;
asyncOut : OUT AsyncBurst_B_r;
asyncIn : IN AsyncBurst_A_r
);
END COMPONENT OCPBurstCDC_B;

SIGNAL async_A : AsyncBurst_A_r;
SIGNAL async_B : AsyncBurst_B_r;

BEGIN

CDC_A : OCPBurstCDC_A
PORT MAP(input.clk_A,
input.rst_A,
input.OCPB_master,
output.OCPB_A,
async_A,
async_B);

CDC_B : OCPBurstCDC_B
PORT MAP(input.clk_B,
input.rst_B,
input.OCPB_slave,
output.OCPB_B,
async_B,
async_A);

END ARCHITECTURE rtl;
Loading

0 comments on commit 761ae63

Please sign in to comment.