Archived page: www.fysel.ntnu.no/modgen/create_mgen_lib.html, Wayback Machine capture of 2002-11-29. About the rebirth

Creating mapped leaf cell library for Modgen

In order to simplify compilation of Modgen modules and improve synthesis results, it is recommended to create a pre-mapped library of the leaf cells. This page describes how this is done.

Run the following Synopsys DC script with the verilog (vhdl) code at the end of this document saved in a file called mgen_lib.vhd.

read -f verilog mgen_lib.v /*read -f vhdl mgen_lib.vhd*/ lc_list = {"INV_GATE", "PP_LOW", "PP_MIDDLE", "PP_HIGH", "R_GATE", "DECODER"} lc_list = lc_list + {"AND_GATE", "NAND_GATE", "FULL_ADDER", "HALF_ADDER"} lc_list = lc_list + {"INVBLOCK", "XXOR1", "XXOR2", "BLOCK0", "BLOCK1", "BLOCK2"} lc_list = lc_list + {"BLOCK1A", "BLOCK2A", "FLIPFLOP"} foreach (lc,lc_list){ current_design=lc compile } write -o mgen_lib.db lc_list

Leaf cell library - VHDL
entity INV_GATE is port ( INA: in bit; OUTQ: out bit ); end INV_GATE; entity PP_LOW is port ( ONEPOS, ONENEG, TWONEG: in bit; INA, INB: in bit; PPBIT: out bit ); end PP_LOW; entity PP_MIDDLE is port ( ONEPOS, ONENEG, TWOPOS, TWONEG: in bit; INA, INB, INC, IND: in bit; PPBIT: out bit ); end PP_MIDDLE; entity PP_HIGH is port ( ONEPOS, ONENEG, TWOPOS, TWONEG: in bit; INA, INB: in bit; PPBIT: out bit ); end PP_HIGH; entity R_GATE is port ( INA, INB, INC: in bit; PPBIT: out bit ); end R_GATE; entity DECODER is port ( INA, INB, INC: in bit; TWOPOS, TWONEG, ONEPOS, ONENEG: out bit ); end DECODER; entity AND_GATE is port ( INA, INB: in bit; OUTQ: out bit ); end AND_GATE; entity NAND_GATE is port ( INA, INB: in bit; OUTQ: out bit ); end NAND_GATE; entity FULL_ADDER is port ( DATA_A, DATA_B, DATA_C: in bit; SAVE, CARRY: out bit ); end FULL_ADDER; entity HALF_ADDER is port ( DATA_A, DATA_B: in bit; SAVE, CARRY: out bit ); end HALF_ADDER; entity INVBLOCK is port ( GIN,PHI:in bit; GOUT:out bit ); end INVBLOCK; entity XXOR1 is port ( A,B,GIN,PHI:in bit; SUM:out bit ); end XXOR1; entity XXOR2 is port ( A,B,GIN,PHI:in bit; SUM:out bit ); end XXOR2; entity BLOCK0 is port ( A,B,PHI:in bit; POUT,GOUT:out bit ); end BLOCK0; entity BLOCK1 is port ( PIN1,PIN2,GIN1,GIN2,PHI:in bit; POUT,GOUT:out bit ); end BLOCK1; entity BLOCK2 is port ( PIN1,PIN2,GIN1,GIN2,PHI:in bit; POUT,GOUT:out bit ); end BLOCK2; entity BLOCK1A is port ( PIN2,GIN1,GIN2,PHI:in bit; GOUT:out bit ); end BLOCK1A; entity BLOCK2A is port ( PIN2,GIN1,GIN2,PHI:in bit; GOUT:out bit ); end BLOCK2A; entity FLIPFLOP is port ( DIN: in bit; CLK: in bit; DOUT: out bit ); end FLIPFLOP; architecture INV_GATE of INV_GATE is begin OUTQ <= NOT INA; end INV_GATE; architecture PP_LOW of PP_LOW is begin PPBIT <= (ONEPOS and INA) or (ONENEG and INB) or TWONEG; end PP_LOW; architecture PP_MIDDLE of PP_MIDDLE is begin PPBIT <= not((not(INA and TWOPOS)) and (not(INB and TWONEG)) and (not(INC and ONEPOS)) and (not(IND and ONENEG))); end PP_MIDDLE; architecture PP_HIGH of PP_HIGH is begin PPBIT <= not ((INA and ONEPOS) or (INB and ONENEG) or (INA and TWOPOS) or (INB and TWONEG)); end PP_HIGH; architecture R_GATE of R_GATE is begin PPBIT <= (not(INA and INB)) and INC; end R_GATE; architecture DECODER of DECODER is begin TWOPOS <= not(not(INA and INB and (not INC))); TWONEG <= not(not((not INA) and (not INB) and INC)); ONEPOS <= ((not INA) and INB and (not INC)) or ((not INC) and (not INB) and INA); ONENEG <= (INA and (not INB) and INC) or (INC and INB and (not INA)); end DECODER; architecture AND_GATE of AND_GATE is begin OUTQ <= INA and INB; end AND_GATE; architecture NAND_GATE of NAND_GATE is begin OUTQ <= not (INA and INB); end NAND_GATE; library GTECH; use GTECH.GTECH_components.all; library IEEE; use IEEE.std_logic_1164.all; architecture FULL_ADDER of FULL_ADDER is -- synopsys dc_script_begin -- set_map_only U1 -- synopsys dc_script_end signal S,C: std_ulogic; begin U1: GTECH_ADD_ABC port map(to_stdulogic(DATA_A) , to_stdulogic(DATA_B) , to_stdulogic(DATA_C) , S , C); SAVE <= to_bit(S); CARRY <= to_bit(C); end FULL_ADDER; library GTECH; use GTECH.GTECH_components.all; library IEEE; use IEEE.std_logic_1164.all; architecture HALF_ADDER of HALF_ADDER is -- synopsys dc_script_begin -- set_map_only U1 -- synopsys dc_script_end signal S,C: std_ulogic; begin U1: GTECH_ADD_AB port map(to_stdulogic(DATA_A) , to_stdulogic(DATA_B) , S , C); SAVE <= to_bit(S); CARRY <= to_bit(C); end HALF_ADDER; architecture INVBLOCK_regular of INVBLOCK is begin GOUT <= not GIN; end INVBLOCK_regular; architecture BLOCK1_regular of BLOCK1 is begin POUT <= not(PIN1 or PIN2); GOUT <= not(GIN2 and (PIN2 or GIN1)); end BLOCK1_regular; architecture BLOCK2_regular of BLOCK2 is begin POUT <= not(PIN1 and PIN2); GOUT <= not(GIN2 or (PIN2 and GIN1)); end BLOCK2_regular; architecture BLOCK1A_regular of BLOCK1A is begin GOUT <= not(GIN2 and (PIN2 or GIN1)); end BLOCK1A_regular; architecture BLOCK2A_regular of BLOCK2A is begin GOUT <= not(GIN2 or (PIN2 and GIN1)); end BLOCK2A_regular; architecture XXOR_regular of XXOR1 is begin SUM <= (not (A xor B)) xor GIN; end XXOR_regular; architecture XXOR_true of XXOR2 is begin SUM <= (A xor B) xor GIN; end XXOR_true; architecture BLOCK0_regular of BLOCK0 is begin POUT <= not(A or B); GOUT <= not(A and B); end BLOCK0_regular; architecture FLIPFLOP of FLIPFLOP is begin process(CLK) begin if(CLK='1')and(CLK'event)then DOUT <= DIN; end if; end process; end FLIPFLOP;



Johnny Pihl