📄 multlib.vhd
字号:
component BLOCK1port( PIN1,PIN2,GIN1,GIN2,PHI:in std_logic; POUT,GOUT:out std_logic);end component;component BLOCK1A port( PIN2,GIN1,GIN2,PHI:in std_logic; GOUT:out std_logic);end component;begin -- Architecture DBLC_2U1: for I in 0 to 3 generate U11: INVBLOCK port map(GIN(I),PHI,GOUT(I));end generate U1;U2: for I in 4 to 7 generate U21: BLOCK1A port map(PIN(I-4),GIN(I-4),GIN(I),PHI,GOUT(I));end generate U2;U3: for I in 8 to 32 generate U31: BLOCK1 port map(PIN(I-8),PIN(I-4),GIN(I-4),GIN(I),PHI,POUT(I-8),GOUT(I));end generate U3;end DBLC_2;-- The DBLC-tree: Level 3library ieee;use ieee.std_logic_1164.all;architecture DBLC_3 of DBLC_3_32 iscomponent INVBLOCKport( GIN,PHI:in std_logic; GOUT:out std_logic);end component;component BLOCK2 port( PIN1,PIN2,GIN1,GIN2,PHI:in std_logic; POUT,GOUT:out std_logic);end component;component BLOCK2A port( PIN2,GIN1,GIN2,PHI:in std_logic; GOUT:out std_logic);end component;begin -- Architecture DBLC_3U1: for I in 0 to 7 generate U11: INVBLOCK port map(GIN(I),PHI,GOUT(I));end generate U1;U2: for I in 8 to 15 generate U21: BLOCK2A port map(PIN(I-8),GIN(I-8),GIN(I),PHI,GOUT(I));end generate U2;U3: for I in 16 to 32 generate U31: BLOCK2 port map(PIN(I-16),PIN(I-8),GIN(I-8),GIN(I),PHI,POUT(I-16),GOUT(I));end generate U3;end DBLC_3;-- The DBLC-tree: Level 4library ieee;use ieee.std_logic_1164.all;architecture DBLC_4 of DBLC_4_32 iscomponent BLOCK1port( PIN1,PIN2,GIN1,GIN2,PHI:in std_logic; POUT,GOUT:out std_logic);end component;component BLOCK1A port( PIN2,GIN1,GIN2,PHI:in std_logic; GOUT:out std_logic);end component;begin -- Architecture DBLC_4 GOUT(0 to 15) <= GIN(0 to 15);U2: for I in 16 to 31 generate U21: BLOCK1A port map(PIN(I-16),GIN(I-16),GIN(I),PHI,GOUT(I));end generate U2;U3: for I in 32 to 32 generate U31: BLOCK1 port map(PIN(I-32),PIN(I-16),GIN(I-16),GIN(I),PHI,POUT(I-32),GOUT(I));end generate U3;end DBLC_4;library ieee;use ieee.std_logic_1164.all;entity XORSTAGE_32 isport( A: in std_logic_vector(0 to 31); B: in std_logic_vector(0 to 31); PBIT, PHI: in std_logic; CARRY: in std_logic_vector(0 to 32); SUM: out std_logic_vector(0 to 31); COUT: out std_logic);end XORSTAGE_32;library ieee;use ieee.std_logic_1164.all;architecture XORSTAGE of XORSTAGE_32 iscomponent XXOR1port( A,B,GIN,PHI:in std_logic; SUM:out std_logic);end component;component XXOR2port( A,B,GIN,PHI:in std_logic; SUM:out std_logic);end component;component BLOCK2A port( PIN2,GIN1,GIN2,PHI:in std_logic; GOUT:out std_logic);end component;begin -- XORSTAGEU2:for I in 0 to 15 generate U22: XXOR1 port map(A(I),B(I),CARRY(I),PHI,SUM(I));end generate U2;U3:for I in 16 to 31 generate U33: XXOR2 port map(A(I),B(I),CARRY(I),PHI,SUM(I));end generate U3;U1: BLOCK2A port map(PBIT,CARRY(0),CARRY(32),PHI,COUT);end XORSTAGE;library ieee;use ieee.std_logic_1164.all;entity PRESTAGE_32 isport( A: in std_logic_vector(0 to 31); B: in std_logic_vector(0 to 31); CIN: in std_logic; PHI: in std_logic; POUT: out std_logic_vector(0 to 31); GOUT: out std_logic_vector(0 to 32));end PRESTAGE_32;library ieee;use ieee.std_logic_1164.all;architecture PRESTAGE of PRESTAGE_32 iscomponent BLOCK0port( A,B,PHI: in std_logic; POUT,GOUT: out std_logic);end component;component INVBLOCKport( GIN,PHI:in std_logic; GOUT:out std_logic);end component;begin -- PRESTAGEU1:for I in 0 to 31 generate U11: BLOCK0 port map(A(I),B(I),PHI,POUT(I),GOUT(I+1));end generate U1;U2: INVBLOCK port map(CIN,PHI,GOUT(0));end PRESTAGE;-- The DBLC-tree: All levels encapsulatedlibrary ieee;use ieee.std_logic_1164.all;entity DBLCTREE_32 isport( PIN:in std_logic_vector(0 to 31); GIN:in std_logic_vector(0 to 32); PHI:in std_logic; GOUT:out std_logic_vector(0 to 32); POUT:out std_logic_vector(0 to 0));end DBLCTREE_32;library ieee;use ieee.std_logic_1164.all;architecture DBLCTREE of DBLCTREE_32 iscomponent DBLC_0_32port( PIN: in std_logic_vector(0 to 31); GIN: in std_logic_vector(0 to 32); PHI: in std_logic; POUT: out std_logic_vector(0 to 30); GOUT: out std_logic_vector(0 to 32));end component;component DBLC_1_32port( PIN: in std_logic_vector(0 to 30); GIN: in std_logic_vector(0 to 32); PHI: in std_logic; POUT: out std_logic_vector(0 to 28); GOUT: out std_logic_vector(0 to 32));end component;component DBLC_2_32port( PIN: in std_logic_vector(0 to 28); GIN: in std_logic_vector(0 to 32); PHI: in std_logic; POUT: out std_logic_vector(0 to 24); GOUT: out std_logic_vector(0 to 32));end component;component DBLC_3_32port( PIN: in std_logic_vector(0 to 24); GIN: in std_logic_vector(0 to 32); PHI: in std_logic; POUT: out std_logic_vector(0 to 16); GOUT: out std_logic_vector(0 to 32));end component;component DBLC_4_32port( PIN: in std_logic_vector(0 to 16); GIN: in std_logic_vector(0 to 32); PHI: in std_logic; POUT: out std_logic_vector(0 to 0); GOUT: out std_logic_vector(0 to 32));end component;signal INTPROP_0: std_logic_vector(0 to 30);signal INTGEN_0: std_logic_vector(0 to 32);signal INTPROP_1: std_logic_vector(0 to 28);signal INTGEN_1: std_logic_vector(0 to 32);signal INTPROP_2: std_logic_vector(0 to 24);signal INTGEN_2: std_logic_vector(0 to 32);signal INTPROP_3: std_logic_vector(0 to 16);signal INTGEN_3: std_logic_vector(0 to 32);begin -- Architecture DBLCTREEU_0: DBLC_0_32 port map(PIN=>PIN,GIN=>GIN,PHI=>PHI,POUT=>INTPROP_0,GOUT=>INTGEN_0);U_1: DBLC_1_32 port map(PIN=>INTPROP_0,GIN=>INTGEN_0,PHI=>PHI,POUT=>INTPROP_1,GOUT=>INTGEN_1);U_2: DBLC_2_32 port map(PIN=>INTPROP_1,GIN=>INTGEN_1,PHI=>PHI,POUT=>INTPROP_2,GOUT=>INTGEN_2);U_3: DBLC_3_32 port map(PIN=>INTPROP_2,GIN=>INTGEN_2,PHI=>PHI,POUT=>INTPROP_3,GOUT=>INTGEN_3);U_4: DBLC_4_32 port map(PIN=>INTPROP_3,GIN=>INTGEN_3,PHI=>PHI,POUT=>POUT,GOUT=>GOUT);end DBLCTREE;library ieee;use ieee.std_logic_1164.all;architecture DBLCADDER of DBLCADDER_32_32 iscomponent PRESTAGE_32port( A: in std_logic_vector(0 to 31); B: in std_logic_vector(0 to 31); CIN: in std_logic; PHI: in std_logic; POUT: out std_logic_vector(0 to 31); GOUT: out std_logic_vector(0 to 32));end component;component DBLCTREE_32port( PIN:in std_logic_vector(0 to 31); GIN:in std_logic_vector(0 to 32); PHI:in std_logic; GOUT:out std_logic_vector(0 to 32); POUT:out std_logic_vector(0 to 0));end component;component XORSTAGE_32port( A: in std_logic_vector(0 to 31); B: in std_logic_vector(0 to 31); PBIT: in std_logic; PHI: in std_logic; CARRY: in std_logic_vector(0 to 32); SUM: out std_logic_vector(0 to 31); COUT: out std_logic);end component;signal INTPROP: std_logic_vector(0 to 31);signal INTGEN: std_logic_vector(0 to 32);signal PBIT:std_logic_vector(0 to 0);signal CARRY: std_logic_vector(0 to 32);begin -- Architecture DBLCADDERU1: PRESTAGE_32 port map(OPA,OPB,CIN,PHI,INTPROP,INTGEN);U2: DBLCTREE_32 port map(INTPROP,INTGEN,PHI,CARRY,PBIT);U3: XORSTAGE_32 port map(OPA(0 to 31),OPB(0 to 31),PBIT(0),PHI,CARRY(0 to 32),SUM,COUT);end DBLCADDER;-------------------------------------------------------------- END: Architectures used with the DBLC adder------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;entity PRESTAGE_128 isport( A: in std_logic_vector(0 to 127); B: in std_logic_vector(0 to 127); CIN: in std_logic; PHI: in std_logic; POUT: out std_logic_vector(0 to 127); GOUT: out std_logic_vector(0 to 128));end PRESTAGE_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_0_128 isport( PIN: in std_logic_vector(0 to 127); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 126); GOUT: out std_logic_vector(0 to 128));end DBLC_0_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_1_128 isport( PIN: in std_logic_vector(0 to 126); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 124); GOUT: out std_logic_vector(0 to 128));end DBLC_1_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_2_128 isport( PIN: in std_logic_vector(0 to 124); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 120); GOUT: out std_logic_vector(0 to 128));end DBLC_2_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_3_128 isport( PIN: in std_logic_vector(0 to 120); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 112); GOUT: out std_logic_vector(0 to 128));end DBLC_3_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_4_128 isport( PIN: in std_logic_vector(0 to 112); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 96); GOUT: out std_logic_vector(0 to 128));end DBLC_4_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_5_128 isport( PIN: in std_logic_vector(0 to 96); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 64); GOUT: out std_logic_vector(0 to 128));end DBLC_5_128;library ieee;use ieee.std_logic_1164.all;entity DBLC_6_128 isport( PIN: in std_logic_vector(0 to 64); GIN: in std_logic_vector(0 to 128); PHI: in std_logic; POUT: out std_logic_vector(0 to 0); GOUT: out std_logic_vector(0 to 128));end DBLC_6_128;library ieee;use ieee.std_logic_1164.all;entity XORSTAGE_128 isport( A: in std_logic_vector(0 to 127); B: in std_logic_vector(0 to 127); PBIT, PHI: in std_logic; CARRY: in std_logic_vector(0 to 128); SUM: out std_logic_vector(0 to 127); COUT: out std_logic);end XORSTAGE_128;library ieee;use ieee.std_logic_1164.all;entity DBLCTREE_128 isport( PIN:in std_logic_vector(0 to 127); GIN:in std_logic_vector(0 to 128); PHI:in std_logic; GOUT:out std_logic_vector(0 to 128); POUT:out std_logic_vector(0 to 0));end DBLCTREE_128;library ieee;use ieee.std_logic_1164.all;entity DBLCADDER_128_128 isport( OPA:in std_logic_vector(0 to 127); OPB:in std_logic_vector(0 to 127); CIN:in std_logic; PHI:in std_logic; SUM:out std_logic_vector(0 to 127); COUT:out std_logic);end DBLCADDER_128_128;library ieee;use ieee.std_logic_1164.all;architecture PRESTAGE of PRESTAGE_128 iscomponent BLOCK0port( A,B,PHI: in std_logic; POUT,GOUT: out std_logic);end component;component INVBLOCKport( GIN,PHI:in std_logic; GOUT:out std_logic);end component;begin -- PRESTAGEU1:for I in 0 to 127 generate U11: BLOCK0 port map(A(I),B(I),PHI,POUT(I),GOUT(I+1));end generate U1;U2: INVBLOCK port map(CIN,PHI,GOUT(0));end PRESTAGE;-- The DBLC-tree: Level 0library ieee;use ieee.std_logic_1164.all;architecture DBLC_0 of DBLC_0_128 iscomponent INVBLOCKport( GIN,PHI:in std_logic; GOUT:out std_logic);end component;component BLOCK1port( PIN1,PIN2,GIN1,GIN2,PHI:in std_logic; POUT,GOUT:out std_logic);end component;component BLOCK1A port( PIN2,GIN1,GIN2,PHI:in std_logic; GOUT:out std_logic);end component;begin -- Architecture DBLC_0U1: for I in 0 to 0 generate U11: INVBLOCK port map(GIN(I),PHI,GOUT(I));end generate U1;U2: for I in 1 to 1 generate U21: BLOCK1A port map(PIN(I-1),GIN(I-1),GIN(I),PHI,GOUT(I));end generate U2;U3: for I in 2 to 128 generate U31: BLOCK1 port map(PIN(I-2),PIN(I-1),GIN(I-1),GIN(I),PHI,POUT(I-2),GOUT(I));end generate U3;end DBLC_0;-- The DBLC-tree: Level 1library ieee;use ieee.std_logic_1164.all;architecture DBLC_1 of DBLC_1_128 iscomponent INVBLOCKport( GIN,PHI:in std_logic; GOUT:out std_logic);end component;component BLOCK2 port( PIN1,PIN2,GIN1,GIN2,PHI:in std_logic; POUT,GOUT:out std_logic);end component;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -