12.07.2015 Views

Tutorial for the Semi Custom Part of the Image Processing System

Tutorial for the Semi Custom Part of the Image Processing System

Tutorial for the Semi Custom Part of the Image Processing System

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

EPFL/STI/IMM/LSMBâtiment ELD, Station 11CH-1015 LausanneSwitzerlandFax: +41(21)69-36959WWW: http://lsm.epfl.ch/VLSI Design II<strong>Tutorial</strong> <strong>for</strong> <strong>the</strong> <strong>Semi</strong> <strong>Custom</strong> <strong>Part</strong> <strong>of</strong> <strong>the</strong> <strong>Image</strong><strong>Processing</strong> <strong>System</strong>Torsten Mähne ∗22 March to 5 April 2007Laboratoire de Systèmes Microélectroniques (LSM)Contents1. Introduction 11.1. Preparation <strong>of</strong> <strong>the</strong> Project Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22. Single Port Random Access Memory (RAM) 33. Histogram Calculation Block 33.1. Session 1: Creation and Simulation <strong>of</strong> <strong>the</strong> VHDL model <strong>of</strong> <strong>the</strong> histogram block . . . . . . 33.2. Session 2: Syn<strong>the</strong>sis <strong>of</strong> <strong>the</strong> Gate-Level Netlist <strong>of</strong> <strong>the</strong> Histogram Block . . . . . . . . . . . 53.3. Session 3: Placement & Routing <strong>of</strong> <strong>the</strong> Histogram Block . . . . . . . . . . . . . . . . . . . 6A. Single Port Random Access Memory (RAM) 6B. Histogram Block 101. IntroductionThe goal <strong>of</strong> this tutorial is to get familiar with <strong>the</strong> Electronic Design Automation (EDA) tools used ina typical semi custom digital design flow. It is based on <strong>the</strong> tutorial [5] given in <strong>the</strong> semi-custom part<strong>of</strong> <strong>the</strong> practical laboratory <strong>for</strong> <strong>the</strong> EDA Based Design Course. It’s principal parts VHDL and Verilogsimulation (Chapter 2), Logic syn<strong>the</strong>sis (Chapter 3), and Standard cell placement and routing (Chapter 4)will be repeated <strong>for</strong> <strong>the</strong> histogram block as follows:Session 1 (22 March 2007): Creation <strong>of</strong> <strong>the</strong> Register Transfer Level (RTL) description in VHDL <strong>of</strong> <strong>the</strong>histogram block and its simulation with Mentor Graphics ModelSimSession 2 (29 March 2007): Logic syn<strong>the</strong>sis <strong>of</strong> a gate-level netlist from <strong>the</strong> RTL description usingSynopsys Design Vision∗ Phone: +41(21)69-36922, E-Mail: torsten.maehne@epfl.chvlsi2_semi_custom_tutorial.tex Rev: 3, March 27, 2007 1


Session 3 (5 April 2007): Automatic placement & routing <strong>of</strong> <strong>the</strong> netlist into a layout <strong>of</strong> <strong>the</strong> histogramblock using Cadence First EncounterThe semi custom part requires good knowledge about VHDL [1]. The behavioural modelling <strong>of</strong>Analogue-to-Digital Converter (ADC) designed in <strong>the</strong> analogue part requires knowledge <strong>of</strong> VHDL-AMS [2].Essential in<strong>for</strong>mation about <strong>the</strong> syntax <strong>of</strong> VHDL [6] and VHDL-AMS [7] and o<strong>the</strong>r electronic documentsare available from <strong>the</strong> Moodle web site (http://moodle.epfl.ch/course/view.php?id=445). The HamburgVHDL Archive [3] provides a collection <strong>of</strong> free, i.e., public-domain or shareware, VHDL documentation,models, and tools.1.1. Preparation <strong>of</strong> <strong>the</strong> Project DirectoryAll files created by <strong>the</strong> designer or generated by EDA tools during <strong>the</strong> course <strong>of</strong> <strong>the</strong> <strong>Image</strong> <strong>Processing</strong><strong>System</strong> (IPS) project should be organised in directory structure as described in Vachoux [5], Sections 1.2to 1.4. Follow <strong>the</strong> following steps to create <strong>the</strong> project directory after logging into immsunsrv2.epfl.chusing one <strong>of</strong> <strong>the</strong> edatpx accounts (with x = 1 . . . 10):1. Create <strong>the</strong> project hierarchy using <strong>the</strong> create_eda_project script:[1]edatp1@immsunsrv2-edatp1> mkdir vlsi2[2]edatp1@immsunsrv2-edatp1> cd vlsi2/[3]edatp1@immsunsrv2-vlsi2> create_eda_project IPS[4]edatp1@immsunsrv2-vlsi2> cd IPS/2. Set-up <strong>the</strong> EDA tools to be used in <strong>the</strong> project by creating or modifying a file called edadk.confin your home directory or <strong>the</strong> top-level <strong>of</strong> your project directory (supersedes ~/edadk.conf). Theedadk.conf file should contain <strong>the</strong> following lines:1 mgc msim 6.2 d2 mgc ams 2006.2 a3 snps syn 2005.094 cds soce 4.15 cds ic 5.1.416 cds assura 3.1.67 cds mgc_ams 2006.2 a8 dk ams hk370edadk.conf3. Install <strong>the</strong> AMS design kit <strong>for</strong> use with Synopsys Design Vision and Cadence First Encounter byissuing <strong>the</strong> following command from <strong>the</strong> top-level <strong>of</strong> your project directory:[5]edatp1@immsunsrv2-IPS> ams_setup -p c35b4 -t synopsys_dc[6]edatp1@immsunsrv2-IPS> ams_setup -p c35b4 -t cadence_soce4. Install <strong>the</strong> AMS design kit <strong>for</strong> use with Cadence IC by launching it once with <strong>the</strong> technologyoption c35b4 from <strong>the</strong> layout subdirectory LAY/:[7]edatp1@immsunsrv2-IPS> cd LAY[8]edatp1@immsunsrv2-LAY> ams_cds -t c35b4 -m fbWhen you are asked <strong>for</strong> <strong>the</strong> exact process option, select C35B4M6. Quit Cadence IC by selectingExit. . . from <strong>the</strong> File menu <strong>of</strong> <strong>the</strong> icfb.5. Change back to <strong>the</strong> top-level <strong>of</strong> <strong>the</strong> project directory:[9]edatp1@immsunsrv2-LAY> cd ..Remember: All EDA tools need to be launched from <strong>the</strong> top-level <strong>of</strong> <strong>the</strong> project directory t<strong>of</strong>ind <strong>the</strong>ir configuration files except <strong>for</strong> Cadence IC, which needs to be launched always from <strong>the</strong>LAY/ subdirectory.2 Rev: 3, March 27, 2007 vlsi2_semi_custom_tutorial.tex


Table 1: Interface <strong>of</strong> <strong>the</strong> Random Access Memory (RAM)Name Type Default Description(a) GenericsNBITS_WORD positive 8 Bits <strong>of</strong> a wordSIZE positive 256 Number <strong>of</strong> wordsNBITS_ADDRESS positive 8 Bits <strong>of</strong> address(b) PortsName Class Dir. Type Descriptionclock signal in std_logic Clock inputreset signal in std_logic Asynchronous reset (activelow)enable signal in std_logic Enable RAM operationrw_select signal in std_logic Select read ’0’ or write ’1’modeaddress signal in std_logic_vector(NBITS_ADDRESS - 1 downto 0) Address to read from orwrite todata_in signal in std_logic_vector(NBITS_WORD - 1 downto 0) Data inputdata_out signal out std_logic_vector(NBITS_WORD - 1 downto 0) Data output2. Single Port Random Access Memory (RAM)The histogram block needs a RAM to store <strong>the</strong> number <strong>of</strong> occurrences <strong>of</strong> each gray scale value <strong>of</strong> a frame.The RAM will be created by <strong>the</strong> full-custom group during <strong>the</strong> course <strong>of</strong> <strong>the</strong> IPS project, but still <strong>the</strong>semi-custom group needs a simulation model, which will also serve as a specification.The interface <strong>of</strong> <strong>the</strong> RAM block consisting <strong>of</strong> generics to configure <strong>the</strong> block and <strong>the</strong> ports to communicatewith <strong>the</strong> block is given in Table 1. The behaviour <strong>of</strong> <strong>the</strong> single port RAM is implemented using asynchronous process with asynchronous active-low reset. If <strong>the</strong> RAM is enabled with enable = ’1’ andrw_select = ’0’, <strong>the</strong>n a data word is read from <strong>the</strong> specified address at each positive clock edge andoutput at data_out. If <strong>the</strong> RAM is enabled with enable = ’1’ and rw_select = ’1’, <strong>the</strong>n <strong>the</strong> data fromdata_in is written to <strong>the</strong> specified address at each positive clock edge. The VDHL source code <strong>of</strong> <strong>the</strong>single port RAM is given in Listing 1.The testbench single port RAM given in Listing 2 carries out <strong>the</strong> test in two steps. First a randompattern is written into each memory cell using a pseudo random number generator. Afterwards all memorycells are read out and <strong>the</strong>ir value is compared with <strong>the</strong> values produced by <strong>the</strong> reinitialised pseudo randomnumber generator.3. Histogram Calculation BlockThe histogram block calculates <strong>the</strong> histogram from <strong>the</strong> serial data read from video_in at each positiveedge <strong>of</strong> <strong>the</strong> video_clock. Its interface definition is given in Table 2. The calculation is restarted aftera frame_start has been signalled. It <strong>the</strong>n calculates <strong>the</strong> histogram <strong>for</strong> <strong>the</strong> whole frame consisting <strong>of</strong>WIDTH * HEIGHT pixels and signals its completion using <strong>the</strong> done signal. The histogram block relies on anexternal single port RAM (Section 2) to store <strong>the</strong> histogram.3.1. Session 1: Creation and Simulation <strong>of</strong> <strong>the</strong> VHDL model <strong>of</strong> <strong>the</strong> histogramblockThe first task <strong>of</strong> this tutorial is to create <strong>the</strong> VHDL model <strong>of</strong> <strong>the</strong> histogram calculation block with <strong>the</strong>interface from Table 2. The block shall have a asynchronous active-low reset. The histogram calculationis controlled through a synchronous Finite State Machine (FSM) (Figure 1).vlsi2_semi_custom_tutorial.tex Rev: 3, March 27, 2007 3


Table 2: Interface <strong>of</strong> <strong>the</strong> histogram calculation blockName Type Default Description(a) GenericsWIDTH positive 320 Width <strong>of</strong> frameHEIGHT positive 240 Height <strong>of</strong> frameNBITS_PIXEL positive 8 Bits per pixelNBITS_HISTOGRAM positive 18 Bits <strong>for</strong> each histogram entry(b) PortsName Class Dir. Type Descriptionclock signal in std_logic Clockreset signal in std_logic Reset (active low)frame_start signal in std_logic Frame startvideo_clock signal in std_logic Video clockvideo_in signal in std_logic_vector(NBITS_PIXEL - 1 downto 0) Digitised video signaldone signal out std_logic Histogram doneread_request signal in std_logic Read request <strong>for</strong><strong>the</strong> histogram dataaddress signal in std_logic_vector(NBITS_PIXEL - 1 downto 0) Address to readfromdata_out signal out std_logic_vector(NBITS_HISTOGRAM - 1 downto 0) Output <strong>for</strong> histogramdataram_rw_select signal out std_logic Read or write modeselect <strong>for</strong> RAMram_enable signal out std_logic Enable signal <strong>for</strong>RAMram_address signal out std_logic_vector(NBITS_PIXEL - 1 downto 0) Address <strong>for</strong> RAMram_data_in signal in std_logic_vector(NBITS_HISTOGRAM - 1 downto 0) Data read fromRAMram_data_out signal out std_logic_vector(NBITS_HISTOGRAM - 1 downto 0) Data written toRAMram_reset signal out std_logic Reset <strong>for</strong> RAM (activelow)4 Rev: 3, March 27, 2007 vlsi2_semi_custom_tutorial.tex


eset = 0START PIXELframe start = 1 ∧ video clock = 1READ HISTOGRAMpixel count ≥ WIDTH · HEIGHTWAIT RAMvideo clock = 1WRITE HISTOGRAMpixel count < WIDTH · HEIGHTREAD PIXELStateSTART_PIXELREAD_PIXELREAD_HISTOGRAMWAIT_RAMWRITE_HISTOGRAMDescriptionWait <strong>for</strong> first frame pixel, read its value, and answer requests <strong>for</strong> histogram entriesWait <strong>for</strong> next pixel and read its valueRead <strong>the</strong> histogram entry corresponding to current pixelWait <strong>for</strong> RAM to complete <strong>the</strong> read requestWrite back <strong>the</strong> incremented histogram entry corresponding to <strong>the</strong> current pixelFigure 1: State diagram <strong>of</strong> <strong>the</strong> histogram calculation blockThe single port RAM is private to <strong>the</strong> syn<strong>the</strong>sisable histogram calculation block, which also governsexternal accesses to <strong>the</strong> RAM. There<strong>for</strong>e, both blocks will be encapsulated into a histogram topblock (Listing 3).The second task is to create <strong>the</strong> testbench <strong>for</strong> <strong>the</strong> histogram top block. The testing approach is similarto <strong>the</strong> one used <strong>for</strong> <strong>the</strong> single port RAM (Listing 2). The testbench shall feed <strong>the</strong> histogram block after<strong>the</strong> reset with a random video signal, from which it calculates in parallel <strong>the</strong> histogram. After <strong>the</strong> blocksignals that it finished <strong>the</strong> calculation <strong>of</strong> <strong>the</strong> histogram <strong>for</strong> <strong>the</strong> current frame, <strong>the</strong> histogram shall be readout and compared with <strong>the</strong> histogram calculated by <strong>the</strong> testbench. If <strong>the</strong>re are discrepancies, an errormessage shall be generated by <strong>the</strong> simulator.3.2. Session 2: Syn<strong>the</strong>sis <strong>of</strong> <strong>the</strong> Gate-Level Netlist <strong>of</strong> <strong>the</strong> Histogram BlockThe Syn<strong>the</strong>sis <strong>of</strong> <strong>the</strong> gate-level netlist from <strong>the</strong> VHDL RTL model <strong>of</strong> <strong>the</strong> histogram block will be doneaccording to <strong>the</strong> description in Vachoux [5], Chapter 3 using Synopsys Design Vision. A Tcl scriptSYN/BIN/histogram_syn.tcl (Listing 4, downloadable from <strong>the</strong> Moodle site) can be used to automatise<strong>the</strong> syn<strong>the</strong>sis <strong>for</strong> different constraints. To run <strong>the</strong> Tcl script, execute <strong>the</strong> following command in a Unix shellfrom <strong>the</strong> IPS/ project directory:vlsi2_semi_custom_tutorial.tex Rev: 3, March 27, 2007 5


[11]edatp1@immsunsrv2-IPS> dc_shell -f SYN/BIN/histogram_syn.tclThe Tcl script can serve as a template <strong>for</strong> syn<strong>the</strong>sis scripts <strong>for</strong> o<strong>the</strong>r digital blocks. An introduction <strong>for</strong><strong>the</strong> usage <strong>of</strong> Tcl in <strong>the</strong> context <strong>of</strong> (Synopsys) EDA tools is given in Syn [4].The post-syn<strong>the</strong>sis simulation with Standard Delay Format (SDF) back annotation <strong>of</strong> <strong>the</strong> gate delays isdone according to Vachoux [5], Section 2.3 using Mentor Graphics ModelSim. A new histogram_top_syn entitywith accompagnying testbench tb_histogram_top_syn needs to created as modified versions <strong>of</strong>histogram_top and tb_histogram_top, which now instantiate <strong>the</strong> syn<strong>the</strong>sised histogram calculation block.The region, to which <strong>the</strong> SDF file SYN/TIM/histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18_clock10ns_share_mapped.sdf needs to be mapped, is dut:histogram_1 and should beentered in <strong>the</strong> SDF tab <strong>of</strong> <strong>the</strong> Start Simulation dialog <strong>of</strong> Mentor Graphics ModelSim.3.3. Session 3: Placement & Routing <strong>of</strong> <strong>the</strong> Histogram BlockThe placement and routing <strong>of</strong> <strong>the</strong> gate-level netlist <strong>of</strong> <strong>the</strong> histogram block will be done accordingto <strong>the</strong> description in Vachoux [5], Chapter 4 using Cadence First Encounter. A Tcl script PAR/BIN/histogram_par.tcl (Listing 6, downloadable from <strong>the</strong> Moodle site) can be used to automatise <strong>the</strong>placement and routing. Be<strong>for</strong>e it can be executed, an Encounter input configuration file PAR/CONF/histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18.conf needs to be created using<strong>the</strong> Design Import. . . Dialog from <strong>the</strong> File menu <strong>of</strong> Cadence Encounter as described in Vachoux [5],Section 4.2. An IO file (Listing 5, downloadable from <strong>the</strong> Moodle site) PAR/CONF/histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18.io controls <strong>the</strong> placement <strong>of</strong> <strong>the</strong> pins and prevents <strong>the</strong>irplacement on one <strong>of</strong> <strong>the</strong> power ring segments, which would lead to Design Rule Checker (DRC) errors. Torun <strong>the</strong> Tcl script, execute <strong>the</strong> following command in a Unix shell from <strong>the</strong> IPS/ project directory:[13]edatp1@immsunsrv2-IPS> encounter -log PAR/LOG/encounter -overwrite \-init PAR/BIN/histogram_par.tcl -winThe Tcl script can serve as a template <strong>for</strong> placement and routing scripts <strong>for</strong> o<strong>the</strong>r digital blocks.The post-placement-and-routing simulation with SDF back annotation <strong>of</strong> <strong>the</strong> gate delays is done accordingto Vachoux [5], Section 2.4 using <strong>the</strong> Verilog module <strong>of</strong> <strong>the</strong> histogram block generated by Cadence FirstEncounter. A new histogram_top_par entity with accompagnying testbench tb_histogram_top_par needs tocreated as modified versions <strong>of</strong> histogram_top and tb_histogram_top, which now instantiate <strong>the</strong> placed androuted histogram calculation block. The region, to which <strong>the</strong> SDF file PAR/TIM/histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18_clock10ns_cts-routed.sdf needs to be mapped, isdut:histogram_1 and should be entered in <strong>the</strong> SDF tab <strong>of</strong> <strong>the</strong> Start Simulation dialog <strong>of</strong> MentorGraphics ModelSim.A. Single Port Random Access Memory (RAM)Listing 1: VHDL source code <strong>of</strong> <strong>the</strong> Single Port RAM1 -- -----------------------------------------------------------------------------2 -- Title : Synchronous Single Port RAM3 -- Project : <strong>Image</strong> <strong>Processing</strong> <strong>System</strong> ( IPS )4 -- -----------------------------------------------------------------------------5 -- File : single_port_ram . vhd6 -- Author : Torsten Maehne < torsten . maehne@epfl .ch >7 -- Company : EPFL / STI / IMM / LSM8 -- Created : 2007 -03 -209 -- Last update : 2007 -03 -2210 -- Plat<strong>for</strong>m : ModelSim 6.2 d11 -- Standard : VHDL ’93/02 , Math Packages12 -- Depends :13 -- -----------------------------------------------------------------------------14 -- Description :15 -- The behaviour <strong>of</strong> <strong>the</strong> single port RAM is implemented using a synchronous16 -- process with asynchronous active - low reset . If <strong>the</strong> RAM is enabled with17 -- enable = ’1’ and rw_select = ’0’, <strong>the</strong>n a data word is read from <strong>the</strong>6 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


18 -- specified address at each positive clock edge and output at data_out . If <strong>the</strong>19 -- RAM is enabled with enable = ’1’ and rw_select = ’1’, <strong>the</strong>n <strong>the</strong> data from20 -- data_in is written to <strong>the</strong> specified address at each positive clock edge .21 -- -----------------------------------------------------------------------------22 -- Copyright (c) 2007 EPFL / STI / IMM / LSM23 -- -----------------------------------------------------------------------------24 -- Revisions : $Id : single_port_ram . vhd 2 2007 -03 -27 13:10:06 Z maehne $25 -- Date Version Author Description26 -- 2007 -03 -20 1.0 maehne Created27 -- -----------------------------------------------------------------------------2829 library ieee ;30 use ieee . std_logic_1164 . all ;31 use ieee . numeric_std . all ;3233 -- -----------------------------------------------------------------------------3435 entity single_port_ram is3637 generic (38 NBITS_WORD : positive := 8; -- bits <strong>of</strong> a word39 SIZE : positive := 256; -- number <strong>of</strong> words40 NBITS_ADDRESS : positive := 8); -- bits <strong>of</strong> address4142 port (43 signal clock : in std_logic ; -- clock input44 signal reset : in std_logic ; -- asynchronous reset ( active low )45 signal enable : in std_logic ; -- enable RAM operation46 signal rw_select : in std_logic ; -- select read ’0’ or write ’1’ mode47 signal address : in std_logic_vector ( NBITS_ADDRESS - 1 downto 0); -- ↵address to read from or write to48 signal data_in : in std_logic_vector ( NBITS_WORD - 1 downto 0); -- data ↵input49 signal data_out : out std_logic_vector ( NBITS_WORD - 1 downto 0)); -- ↵data output5051 end entity single_port_ram ;5253 -- -----------------------------------------------------------------------------5455 architecture behavioural <strong>of</strong> single_port_ram is5657 begin -- architecture behavioural5859 -- purpose : control <strong>the</strong> read and write process to <strong>the</strong> RAM60 -- type : sequential61 -- inputs : clock , reset , enable , rw_select , address62 -- outputs : data_out63 ram_control : process ( clock , reset ) is64 type word_vector is array ( natural range ) <strong>of</strong> ↵std_logic_vector ( NBITS_WORD - 1 downto 0);65 variable memory : word_vector (0 to SIZE - 1) := ( o<strong>the</strong>rs => ( o<strong>the</strong>rs => ↵’0’)); -- memory66 begin -- process ram_fsm67 if reset = ’0’ <strong>the</strong>n -- asynchronous reset ( active low )68 memory := ( o<strong>the</strong>rs => ( o<strong>the</strong>rs => ’0’));69 data_out ’0’);70 elsif clock ’ event and clock = ’1’ <strong>the</strong>n -- rising clock edge71 if enable = ’1’ and rw_select = ’0’ <strong>the</strong>n -- read from RAM72 data_out


75 else -- do nothing76 null ;77 end if;78 end if;79 end process ram_control ;8081 end architecture behavioural ;8283 -- -----------------------------------------------------------------------------Listing 2: Testbench <strong>for</strong> <strong>the</strong> Single Port RAM1 -- -----------------------------------------------------------------------------2 -- Title : Testbench <strong>for</strong> design " single_port_ram "3 -- Project : <strong>Image</strong> <strong>Processing</strong> <strong>System</strong> ( IPS )4 -- -----------------------------------------------------------------------------5 -- File : tb_single_port_ram . vhd6 -- Author : Torsten Maehne < torsten . maehne@epfl .ch >7 -- Company : EPFL / STI / IMM / LSM8 -- Created : 2007 -03 -209 -- Last update : 2007 -03 -2310 -- Plat<strong>for</strong>m : ModelSim 6.2 d11 -- Standard : VHDL ’93/02 , Math Packages12 -- Depends : single_port_ram13 -- -----------------------------------------------------------------------------14 -- Description :15 -- The single port RAM is tested in two steps . First a random pattern is16 -- written into each memory cell using a pseudo random number generator .17 -- Afterwards all memory cells are read out and <strong>the</strong>ir value is compared with18 -- <strong>the</strong> values produced by <strong>the</strong> reinitialised pseudo random generator .19 -- -----------------------------------------------------------------------------20 -- Copyright (c) 2007 EPFL / STI / IMM / LSM21 -- -----------------------------------------------------------------------------22 -- Revisions : $Id : tb_single_port_ram . vhd 2 2007 -03 -27 13:10:06 Z maehne $23 -- Date Version Author Description24 -- 2007 -03 -20 1.0 maehne Created25 -- -----------------------------------------------------------------------------2627 library ieee ;28 use ieee . std_logic_1164 . all ;29 use ieee . numeric_std . all ;30 use ieee . math_real . all ;3132 -- -----------------------------------------------------------------------------3334 entity tb_single_port_ram is3536 end entity tb_single_port_ram ;3738 -- -----------------------------------------------------------------------------3940 architecture testbench <strong>of</strong> tb_single_port_ram is4142 -- testbench constants43 constant CLOCK_PERIOD : time := 10 ns; -- clock period44 constant T_WAIT : time := 2 * CLOCK_PERIOD ; -- wait time till start <strong>of</strong> test ↵pattern generation4546 -- random generator47 constant INITIAL_SEED_1 : positive := 1; -- initial seed 148 constant INITIAL_SEED_2 : positive := 1; -- initial seed 2498 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


50 -- component generics51 constant NBITS_WORD : positive := 8;52 constant SIZE : positive := 256;53 constant NBITS_ADDRESS : positive := 8;5455 -- component ports56 signal rw_select : std_logic ;57 signal address : std_logic_vector ( NBITS_ADDRESS - 1 downto 0);58 signal data_in : std_logic_vector ( NBITS_WORD - 1 downto 0);59 signal data_out : std_logic_vector ( NBITS_WORD - 1 downto 0);60 signal enable : std_logic ;61 signal clock : std_logic := ’1’;62 signal reset : std_logic ;6364 begin -- architecture testbench6566 -- component instantiation67 DUT : entity work . single_port_ram68 generic map (69 NBITS_WORD => NBITS_WORD ,70 SIZE => SIZE ,71 NBITS_ADDRESS => NBITS_ADDRESS )72 port map (73 rw_select => rw_select ,74 address => address ,75 data_in => data_in ,76 data_out => data_out ,77 enable => enable ,78 clock => clock ,79 reset => reset );8081 -- clock generation82 clock


107 end loop ; -- i108109 wait until falling_edge ( clock );110 enable


2425 library ieee ;26 use ieee . std_logic_1164 . all ;2728 -- -----------------------------------------------------------------------------2930 entity histogram_top is3132 generic (33 WIDTH : positive := 320; -- width <strong>of</strong> frame34 HEIGHT : positive := 240; -- height <strong>of</strong> frame35 NBITS_PIXEL : positive := 8; -- bits per pixel36 NBITS_HISTOGRAM : positive := 18) ; -- bits <strong>for</strong> each histogram entry3738 port (39 signal clock : in std_logic ; -- clock40 signal reset : in std_logic ; -- reset41 signal frame_start : in std_logic ; -- frame start42 signal video_clock : in std_logic ; -- video clock43 signal video_in : in std_logic_vector ( NBITS_PIXEL - 1 downto 0); -- ↵digitised video signal44 signal done : out std_logic ; -- histogram done45 signal read_request : in std_logic ; -- read request <strong>for</strong> <strong>the</strong> histogram data46 signal address : in std_logic_vector ( NBITS_PIXEL - 1 downto 0); -- ↵address to read from47 signal data_out : out std_logic_vector ( NBITS_HISTOGRAM - 1 downto 0)); ↵-- output <strong>for</strong> histogram data4849 end entity histogram_top ;5051 -- -----------------------------------------------------------------------------5253 architecture structural <strong>of</strong> histogram_top is5455 signal ram_reset : std_logic ; -- reset <strong>for</strong> RAM56 signal ram_enable : std_logic ; -- enable signal <strong>for</strong> RAM57 signal ram_rw_select : std_logic ; -- read or write mode select <strong>for</strong> RAM58 signal ram_address : std_logic_vector ( NBITS_PIXEL - 1 downto 0); -- ↵address <strong>for</strong> RAM59 signal ram_data_in : std_logic_vector ( NBITS_HISTOGRAM - 1 downto 0); -- ↵data read from RAM60 signal ram_data_out : std_logic_vector ( NBITS_HISTOGRAM - 1 downto 0); -- ↵data written to RAM6162 begin -- architecture structural6364 histogram_1 : entity work . histogram65 generic map (66 WIDTH => WIDTH ,67 HEIGHT => HEIGHT ,68 NBITS_PIXEL => NBITS_PIXEL ,69 NBITS_HISTOGRAM => NBITS_HISTOGRAM )70 port map (71 clock => clock ,72 reset => reset ,73 frame_start => frame_start ,74 video_clock => video_clock ,75 video_in => video_in ,76 done => done ,77 read_request => read_request ,78 address => address ,79 data_out => data_out ,vlsi2semicustomtutorial.tex Rev: 3, March 27, 2007 11


80 ram_reset => ram_reset ,81 ram_enable => ram_enable ,82 ram_rw_select => ram_rw_select ,83 ram_address => ram_address ,84 ram_data_in => ram_data_in ,85 ram_data_out => ram_data_out );8687 single_port_ram_1 : entity work . single_port_ram88 generic map (89 NBITS_WORD => NBITS_HISTOGRAM ,90 SIZE => 2** NBITS_PIXEL ,91 NBITS_ADDRESS => NBITS_PIXEL )92 port map (93 clock => clock ,94 enable => ram_enable ,95 reset => ram_reset ,96 rw_select => ram_rw_select ,97 address => ram_address ,98 data_in => ram_data_out ,99 data_out => ram_data_in );100101 end architecture structural ;102103 -- -----------------------------------------------------------------------------Listing 4: Synopsys DC Tcl script <strong>for</strong> <strong>the</strong> histogram calculation block1 # -----------------------------------------------------------------------------2 # Title : Synopsys DC Tcl script <strong>for</strong> <strong>the</strong> histogram calculation block3 # Project : <strong>Image</strong> <strong>Processing</strong> <strong>System</strong>4 # -----------------------------------------------------------------------------5 # File : histogram_syn.tcl6 # Author : Torsten Maehne < torsten.maehne@epfl.ch >7 # Company : EPFL / STI / IMM / LSM8 # Created : 2007 -03-259 # Last update: 2007 -03-2510 # Plat<strong>for</strong>m : Synopsys Design Vision 2005 .0911 # Process : AMS 0 .35u CMOS ( C35 ), Hit-Kit 3 .7012 # Depends : histogram.vhd13 # -----------------------------------------------------------------------------14 # Description:15 # It is assumed that a project directory structure has already been16 # created using ’ create_eda_project ’ and that this syn<strong>the</strong>sis script is17 # executed from <strong>the</strong> project root directory $PROJECT_DIR18 # -----------------------------------------------------------------------------19 # Copyright (c) 2007 EPFL / STI / IMM / LSM20 # -----------------------------------------------------------------------------21 # Revisions : $Id: histogram_syn.tcl 2 2007 -03-27 13 :10:06Z maehne $22 # Date Version Author Description23 # 2007 -03-25 1.0 maehne Created on <strong>the</strong> base <strong>of</strong> addsub_syn.tcl ( vachoux )24 # -----------------------------------------------------------------------------252627 set PROJECT_DIR [ pwd ]2829 # -----------------------------------------------------------------------------30 # Design related in<strong>for</strong>mation ( can be changed )31 # -----------------------------------------------------------------------------32 set VHDL_ENTITY histogram33 set VHDL_ARCH behavioural34 set WIDTH 32035 set HEIGHT 24012 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


36 set NBITS_PIXEL 837 set NBITS_HISTOGRAM 1838 set CLK_NAME clock39 # all time values are in ns40 set CLK_PERIOD 10;41 set INPUT_DELAY 2;42 set OUTPUT_DELAY 2;43 set OPERATING_COND WORST-IND4445 # -----------------------------------------------------------------------------46 # Flags that drive <strong>the</strong> script behavior ( can be changed )47 #48 # DB_FORMAT (db | ddc )49 # if db, use <strong>the</strong> old DB <strong>for</strong>mat to store design in<strong>for</strong>mation50 # if ddc, use <strong>the</strong> new XG <strong>for</strong>mat to store design in<strong>for</strong>mation ( recommended )51 # SHARE_RESOURCES (0 | 1)52 # if 1, <strong>for</strong>ce <strong>the</strong> tool to share resources as much as possible53 # if 0, no resource sharing54 # COMPILE_SIMPLE (0 | 1)55 # if 1, only do a single compile with default arguments56 # if 0, do a two-step compilation with ungrouping in between57 # OPT ( string )58 # can be used to generate different mapped file names59 # -----------------------------------------------------------------------------60 set DB_FORMAT ddc61 set SHARE_RESOURCES 162 set COMPILE_SIMPLE 163 set OPT " _clock10ns_share "64${ VHDL_ENTITY } _WIDTH$ { WIDTH } _HEIGHT$ { HEIGHT } _NBITS_PIXEL$ { NBITS_PIXEL } _NBITS_HISTOGRAM$ { NBI65 # -----------------------------------------------------------------------------66 # File names67 # -----------------------------------------------------------------------------68 set SOURCE_FILE_NAME ${ VHDL_ENTITY }69 set ROOT_FILE_NAME ↵70 set VHDL_SOURCE_FILE_NAME ${ SOURCE_FILE_NAME } .vhd71 set ELAB_FILE_NAME ${ ROOT_FILE_NAME }${ OPT } _elab72 set MAPPED_FILE_NAME ${ ROOT_FILE_NAME }${ OPT } _mapped73 set DB_ELAB_FILE_NAME ${ ELAB_FILE_NAME } .$DB_FORMAT74 set DB_MAPPED_FILE_NAME ${ MAPPED_FILE_NAME } .$DB_FORMAT75 set VHDL_NETLIST_FILE_NAME ${ MAPPED_FILE_NAME } .vhd76 set VLOG_NETLIST_FILE_NAME ${ MAPPED_FILE_NAME }.v77 set SDF_FILE_NAME ${ MAPPED_FILE_NAME } .sdf78 set SDC_FILE_NAME ${ MAPPED_FILE_NAME } .sdc79 set RPT_AREA_FILE_NAME ${ MAPPED_FILE_NAME } _area.rpt80 set RPT_TIMING_FILE_NAME ${ MAPPED_FILE_NAME } _timing.rpt81 set RPT_RESOURCES_FILE_NAME ${ MAPPED_FILE_NAME } _resources.rpt82 set RPT_REFERENCES_FILE_NAME ${ MAPPED_FILE_NAME } _references.rpt83 set RPT_CELLS_FILE_NAME ${ MAPPED_FILE_NAME } _cells.rpt8485 # -----------------------------------------------------------------------------86 # Absolute paths87 # -----------------------------------------------------------------------------88 set VHDL_SOURCE_FILE ${ PROJECT_DIR }/ HDL / RTL /${ VHDL_SOURCE_FILE_NAME }89 set VHDL_NETLIST_FILE ${ PROJECT_DIR }/ HDL / GATE /${ VHDL_NETLIST_FILE_NAME }90 set VLOG_NETLIST_FILE ${ PROJECT_DIR }/ HDL / GATE /${ VLOG_NETLIST_FILE_NAME }91 set DB_ELAB_FILE ${ PROJECT_DIR }/ SYN /DB/${ DB_ELAB_FILE_NAME }92 set DB_MAPPED_FILE ${ PROJECT_DIR }/ SYN /DB/${ DB_MAPPED_FILE_NAME }93 set SDF_FILE ${ PROJECT_DIR }/ SYN / TIM /${ SDF_FILE_NAME }94 set SDC_FILE ${ PROJECT_DIR }/ SYN / SDC /${ SDC_FILE_NAME }95 set RPT_AREA_FILE ${ PROJECT_DIR }/ SYN / RPT /${ RPT_AREA_FILE_NAME }96 set RPT_TIMING_FILE ${ PROJECT_DIR }/ SYN / RPT /${ RPT_TIMING_FILE_NAME }vlsi2semicustomtutorial.tex Rev: 3, March 27, 2007 13


97 set RPT_RESOURCES_FILE ${ PROJECT_DIR }/ SYN / RPT /${ RPT_RESOURCES_FILE_NAME }98 set RPT_REFERENCES_FILE ${ PROJECT_DIR }/ SYN / RPT /${ RPT_REFERENCES_FILE_NAME }99 set RPT_CELLS_FILE ${ PROJECT_DIR }/ SYN / RPT /${ RPT_CELLS_FILE_NAME }100101 # -----------------------------------------------------------------------------102 # Analyze RTL source103 # -----------------------------------------------------------------------------104 analyze -<strong>for</strong>mat vhdl -lib WORK $VHDL_SOURCE_FILE105106 # -----------------------------------------------------------------------------107 # Elaborate design108 # -----------------------------------------------------------------------------109 elaborate $VHDL_ENTITY \110 -arch $VHDL_ARCH \111 -lib DEFAULT -update \112 -param " WIDTH=$ { WIDTH },␣ HEIGHT=$ { HEIGHT },␣ NBITS_PIXEL=$ { NBITS_PIXEL },␣↵NBITS_HISTOGRAM=$ { NBITS_HISTOGRAM }"113114 check_design115116 # -----------------------------------------------------------------------------117 # Define environment118 # -----------------------------------------------------------------------------119 set_operating_conditions -library c35_CORELIB $OPERATING_COND120121 # -----------------------------------------------------------------------------122 # Define constraints123 # -----------------------------------------------------------------------------124 create_clock -name $CLK_NAME -period $CLK_PERIOD [ get_ports $CLK_NAME ]125126 set_input_delay $INPUT_DELAY -clock $CLK_NAME [ list [ all_inputs ]]127 set_output_delay $OUTPUT_DELAY -clock $CLK_NAME [ list [ all_outputs ]]128129 set_max_area 0130131 # Use only plain DFF cells132 set_dont_use [ list c35_CORELIB.db:c35_CORELIB / DFE* \133 c35_CORELIB.db:c35_CORELIB / DFS* \134 c35_CORELIB.db:c35_CORELIB / TF* \135 c35_CORELIB.db:c35_CORELIB / JK* ]136137 set_fix_multiple_port_nets -all138139 # -----------------------------------------------------------------------------140 # Set resource allocation and implementation141 # -----------------------------------------------------------------------------142 set_resource_implementation use_fastest143 if { $SHARE_RESOURCES } {144 set_resource_allocation area_only145 } else {146 set_resource_allocation none147 }148149 # -----------------------------------------------------------------------------150 # Save elaborated design and constraints151 # -----------------------------------------------------------------------------152 write -hierarchy -<strong>for</strong>mat $DB_FORMAT -output $DB_ELAB_FILE153154 # -----------------------------------------------------------------------------155 # Map design to gates156 # -----------------------------------------------------------------------------157 if { $COMPILE_SIMPLE } {14 Rev: 3, March 27, 2007vlsi2}semicustomtutorial.tex


158 compile159 } else { compile -map_ef<strong>for</strong>t medium -area_ef<strong>for</strong>t medium160 ungroup -all -flatten161 compile -incremental -map_ef<strong>for</strong>t high162 }163164 # -----------------------------------------------------------------------------165 # Save mapped design166 # -----------------------------------------------------------------------------167 write -hierarchy -<strong>for</strong>mat $DB_FORMAT -output $DB_MAPPED_FILE168169 # -----------------------------------------------------------------------------170 # Generate reports171 # -----------------------------------------------------------------------------172 report_area -nosplit > $RPT_AREA_FILE173 report_timing -path full \174 -delay max \175 -nworst 1 \176 -max_paths 1 \177 -significant_digits 2 \178 -nosplit \179 -sort_by group \180 > $RPT_TIMING_FILE181 report_resources -nosplit -hierarchy > $RPT_RESOURCES_FILE182 report_reference -nosplit > $RPT_REFERENCES_FILE183 report_cell -nosplit > $RPT_CELLS_FILE184185 # -----------------------------------------------------------------------------186 # Generate VHDL netlist187 # -----------------------------------------------------------------------------188 change_names -rule vhdl -hierarchy -verbose189 write -<strong>for</strong>mat vhdl -hierarchy -output $VHDL_NETLIST_FILE190191 # -----------------------------------------------------------------------------192 # Generate SDF data193 # -----------------------------------------------------------------------------194 write_sdf -version 2.1 $SDF_FILE195196 # -----------------------------------------------------------------------------197 # Generate Verilog netlist198 #199 # The design is reloaded from scratch to avoid potential naming problems200 # when using <strong>the</strong> netlist <strong>for</strong> placement and routing201 # -----------------------------------------------------------------------------202 remove_design -all203 read_file -<strong>for</strong>mat $DB_FORMAT $DB_MAPPED_FILE204 change_names -rule verilog -hierarchy -verbose205 write -<strong>for</strong>mat verilog -hierarchy -output $VLOG_NETLIST_FILE206207 # -----------------------------------------------------------------------------208 # Save system constraints209 # -----------------------------------------------------------------------------210 write_sdc -nosplit $SDC_FILEListing 5: Cadence First Encounter IO assignment file <strong>for</strong> <strong>the</strong> histogram calculation block1 # #####################################################2 # #3 # Cadence Design <strong>System</strong>s, Inc. #4 # Cadence (R) Encounter (TM) IO Assignments #5 # #6 # #####################################################vlsi2semicustomtutorial.tex Rev: 3, March 27, 2007 15


78 Version: 2910 # Syntax:11 # Pin: 12 # where may be ei<strong>the</strong>r one <strong>of</strong>:13 # n north ( top )14 # e east ( right )15 # s south ( bottom )16 # w west ( left )1718 Offset: 16 .019 Pin: clock w20 Pin: reset w21 Pin: frame_start w22 Pin: video_clock w23 Pin: video_in [7] w24 Pin: video_in [6] w25 Pin: video_in [5] w26 Pin: video_in [4] w27 Pin: video_in [3] w28 Pin: video_in [2] w29 Pin: video_in [1] w30 Pin: video_in [0] w31 Pin: read_request w32 Pin: address [7] w33 Pin: address [6] w34 Pin: address [5] w35 Pin: address [4] w36 Pin: address [3] w37 Pin: address [2] w38 Pin: address [1] w39 Offset: 211 .040 Pin: address [0] w4142 Offset: 16 .043 Pin: done e44 Pin: data_out [17] e45 Pin: data_out [16] e46 Pin: data_out [15] e47 Pin: data_out [14] e48 Pin: data_out [13] e49 Pin: data_out [12] e50 Pin: data_out [11] e51 Pin: data_out [10] e52 Pin: data_out [9] e53 Pin: data_out [8] e54 Pin: data_out [7] e55 Pin: data_out [6] e56 Pin: data_out [5] e57 Pin: data_out [4] e58 Pin: data_out [3] e59 Pin: data_out [2] e60 Pin: data_out [1] e61 Offset: 211 .062 Pin: data_out [0] e6364 Offset: 16 .065 Pin: ram_reset n66 Pin: ram_enable n67 Pin: ram_rw_select n68 Pin: ram_data_in [17] n16 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


69 Pin: ram_data_in [16] n70 Pin: ram_data_in [15] n71 Pin: ram_data_in [14] n72 Pin: ram_data_in [13] n73 Pin: ram_data_in [12] n74 Pin: ram_data_in [11] n75 Pin: ram_data_in [10] n76 Pin: ram_data_in [9] n77 Pin: ram_data_in [8] n78 Pin: ram_data_in [7] n79 Pin: ram_data_in [6] n80 Pin: ram_data_in [5] n81 Pin: ram_data_in [4] n82 Pin: ram_data_in [3] n83 Pin: ram_data_in [2] n84 Pin: ram_data_in [1] n85 Pin: ram_data_in [0] n86 Pin: ram_data_out [17] n87 Pin: ram_data_out [16] n88 Pin: ram_data_out [15] n89 Pin: ram_data_out [14] n90 Pin: ram_data_out [13] n91 Pin: ram_data_out [12] n92 Pin: ram_data_out [11] n93 Pin: ram_data_out [10] n94 Pin: ram_data_out [9] n95 Pin: ram_data_out [8] n96 Pin: ram_data_out [7] n97 Pin: ram_data_out [6] n98 Pin: ram_data_out [5] n99 Pin: ram_data_out [4] n100 Pin: ram_data_out [3] n101 Pin: ram_data_out [2] n102 Pin: ram_data_out [1] n103 Offset: 218 .0104 Pin: ram_data_out [0] nListing 6: Cadence First Encounter Tcl script <strong>for</strong> <strong>the</strong> histogram calculation block1 # -----------------------------------------------------------------------------2 # Title : Cadence Encounter Tcl script <strong>for</strong> <strong>the</strong> histogram calculation block3 # Project : <strong>Image</strong> <strong>Processing</strong> <strong>System</strong>4 # -----------------------------------------------------------------------------5 # File : histogram_par.tcl6 # Author : Torsten Maehne < torsten.maehne@epfl.ch >7 # Company : EPFL / STI / IMM / LSM8 # Created : 2007 -03-259 # Last update: 2007 -03-2510 # Plat<strong>for</strong>m : Cadence Encounter 5.211 # Process : AMS 0 .35u CMOS ( C35 ), Hit-Kit 3 .7012 # Depends : histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18.v13 # histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18.conf14 # histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM18.io15 # -----------------------------------------------------------------------------16 # Description:17 # It is assumed that a project directory structure has already been18 # created using ’ create_eda_project ’ and that this place and route script is19 # executed from <strong>the</strong> project root directory $PROJECT_DIR20 # -----------------------------------------------------------------------------21 # Copyright (c) 2007 EPFL / STI / IMM / LSM22 # -----------------------------------------------------------------------------23 # Revisions : $Id: histogram_par.tcl 2 2007 -03-27 13 :10:06Z maehne $vlsi2semicustomtutorial.tex Rev: 3, March 27, 2007 17


24 # Date Version Author Description25 # 2007 -03-25 1.0 maehne Created on <strong>the</strong> base <strong>of</strong> addsub_par.tcl ( vachoux )26 # -----------------------------------------------------------------------------272829 set PROJECT_DIR [ pwd ]3031 # -----------------------------------------------------------------------------32 # Design related in<strong>for</strong>mation ( can be changed )33 # -----------------------------------------------------------------------------34 set DESIGN histogram_WIDTH320_HEIGHT240_NBITS_PIXEL8_NBITS_HISTOGRAM183536 set TIM_LIBRARY C35_CORELIB37 set TIM_OC_MAX WORST-IND ;# TYPICAL | WORST | WORST-IND38 set TIM_OC_MIN BEST-IND ;# TYPICAL | BEST | BEST-IND3940 # Floorplan settings41 #42 set FP_ASPECT_RATIO 1.043 set FP_ROW_DENSITY 0 .85 ;# percent44 set FP_CORE2IO 16 ;# micron4546 # Power ring and settings47 #48 set PR_WIDTH 4 ;# micron49 set PR_SPACING 0.6 ;# micron50 set PR_LAYER_TB MET1 ;# top and bottom layer51 set PR_LAYER_LR MET2 ;# left and right layer5253 # Power stripe settings54 #55 set ST_NUM_SETS 1 ;# number <strong>of</strong> sets56 set ST_SPACING 1 ;# micron57 set ST_LAYER_V $PR_LAYER_LR58 set ST_WIDTH 2 ;# micron59 set ST_XOFS_R 100 ;# micron60 set ST_XOFS_L 100 ;# micron6162 # Placement settings63 #64 set PL_EFFORT -high ;# -low | -medium | -high6566 # Clock tree syn<strong>the</strong>sis settings67 #68 set CTS_BUFFER BUF269 set CTS_INV INV07071 # Filler cells72 #73 set FILLER_CELLS \74 " FILLRT25 ␣ FILLRT10 ␣ FILLRT5 ␣ FILLRT2 ␣ FILLRT1 ␣ FILL25 ␣ FILL10 ␣ FILL5 ␣ FILL2 ␣ FILL1 "7576 # -----------------------------------------------------------------------------77 # Flags that drive <strong>the</strong> script behavior ( can be changed )78 #79 # ADD_STRIPES (0 | 1)80 # if 1, add stripes81 # PLACE_TIMING (0 | 1)82 # if 1, do a timing driven placement83 # CLOCK_TREE (0 | 1)84 # if 1, create a clock tree85 # CTS_CREATE_SPEC (0 | 1)18 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


86 # if 1, create a clock tree specification file with default values87 # ROUTE_TIMING (0 | 1)88 # if 1, do a timing driven routing89 # OPT ( string )90 # can be used to have different generated file names91 # -----------------------------------------------------------------------------92 set ADD_STRIPES 193 set PLACE_TIMING 194 set CLOCK_TREE 195 set CTS_CREATE_SPEC 096 set ROUTE_TIMING 197 set OPT " _clock10ns_cts "9899 # -----------------------------------------------------------------------------100 # File names101 # -----------------------------------------------------------------------------102 set CONF_FILE_NAME ${ DESIGN } .conf103 set IO_FILE_NAME ${ DESIGN } .io104 set DESIGN_NAME ${ DESIGN }${ OPT }105 set SAVE_DESIGN_FP_NAME ${ DESIGN_NAME } -fplan.enc106 set SAVE_DESIGN_PR_NAME ${ DESIGN_NAME } -pring.enc107 set SAVE_DESIGN_PL_NAME ${ DESIGN_NAME } -placed.enc108 set SAVE_DESIGN_PF_NAME ${ DESIGN_NAME } -placed_filled.enc109 set SAVE_DESIGN_CT_NAME ${ DESIGN_NAME } -cts.enc110 set SAVE_DESIGN_RO_NAME ${ DESIGN_NAME } -routed.enc111 set TIM_RCDB_NAME ${ DESIGN_NAME } .rcdb112 set SDF_FILE_NAME ${ DESIGN_NAME } -routed.sdf113 set SPEF_FILE_NAME ${ DESIGN_NAME } -routed.spef114 set RPT_CHECK_TA_NAME ${ DESIGN_NAME } -checkta.rpt115 set RPT_REPORT_TA_NAME ${ DESIGN_NAME } -ta.rpt116 set RPT_SLACK_NAME ${ DESIGN_NAME } -slack.rpt117 set RPT_GATE_COUNT_NAME ${ DESIGN_NAME } -gate_count.rpt118 set RPT_NOTCH_NAME ${ DESIGN_NAME } -notch.rpt119 set RPT_CONN_NAME ${ DESIGN_NAME } -conn.rpt120 set RPT_GEOM_NAME ${ DESIGN_NAME } -geom.rpt121 set RPT_DENSITY_NAME ${ DESIGN_NAME } -density.rpt122 set VLOG_NETLIST_SIM_NAME ${ DESIGN_NAME } -routed.v123 set VLOG_NETLIST_LVS_NAME ${ DESIGN_NAME } -routed_lvs.v124 set CTS_SPEC_NAME ${ DESIGN_NAME } -spec.cts125 set CTS_RGUIDE_NAME ${ DESIGN_NAME } -guide.cts126 set CTS_RPT_NAME ${ DESIGN_NAME } -cts.rpt127 set GDS_FILE_NAME ${ DESIGN_NAME } .gds128129 # -----------------------------------------------------------------------------130 # Absolute paths131 # -----------------------------------------------------------------------------132 set CONF_FILE ${ PROJECT_DIR }/ PAR / CONF /${ CONF_FILE_NAME }133 set IO_FILE ${ PROJECT_DIR }/ PAR / CONF /${ IO_FILE_NAME }134 set SAVE_DESIGN_FP_FILE ${ PROJECT_DIR }/ PAR /DB/${ SAVE_DESIGN_FP_NAME }135 set SAVE_DESIGN_PR_FILE ${ PROJECT_DIR }/ PAR /DB/${ SAVE_DESIGN_PR_NAME }136 set SAVE_DESIGN_PL_FILE ${ PROJECT_DIR }/ PAR /DB/${ SAVE_DESIGN_PL_NAME }137 set SAVE_DESIGN_PF_FILE ${ PROJECT_DIR }/ PAR /DB/${ SAVE_DESIGN_PF_NAME }138 set SAVE_DESIGN_CT_FILE ${ PROJECT_DIR }/ PAR /DB/${ SAVE_DESIGN_CT_NAME }139 set SAVE_DESIGN_RO_FILE ${ PROJECT_DIR }/ PAR /DB/${ SAVE_DESIGN_RO_NAME }140 set SDF_FILE ${ PROJECT_DIR }/ PAR / TIM /${ SDF_FILE_NAME }141 set SPEF_FILE ${ PROJECT_DIR }/ PAR / TIM /${ SPEF_FILE_NAME }142 set TIM_RCDB_FILE ${ PROJECT_DIR }/ PAR / TIM /${ TIM_RCDB_NAME }143 set RPT_CHECK_TA_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_CHECK_TA_NAME }144 set RPT_REPORT_TA_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_REPORT_TA_NAME }145 set RPT_SLACK_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_SLACK_NAME }146 set RPT_GATE_COUNT_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_GATE_COUNT_NAME }147 set RPT_NOTCH_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_NOTCH_NAME }vlsi2semicustomtutorial.tex Rev: 3, March 27, 2007 19


148 set RPT_CONN_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_CONN_NAME }149 set RPT_GEOM_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_GEOM_NAME }150 set RPT_DENSITY_FILE ${ PROJECT_DIR }/ PAR / RPT /${ RPT_DENSITY_NAME }151 set VLOG_NETLIST_SIM_FILE ${ PROJECT_DIR }/ HDL / GATE /${ VLOG_NETLIST_SIM_NAME }152 set VLOG_NETLIST_LVS_FILE ${ PROJECT_DIR }/ HDL / GATE /${ VLOG_NETLIST_LVS_NAME }153 set CTS_SPEC_FILE ${ PROJECT_DIR }/ PAR / CTS /${ CTS_SPEC_NAME }154 set CTS_RGUIDE_FILE ${ PROJECT_DIR }/ PAR / CTS /${ CTS_RGUIDE_NAME }155 set CTS_RPT_FILE ${ PROJECT_DIR }/ PAR / RPT /${ CTS_RPT_NAME }156 set GDS_FILE ${ PROJECT_DIR }/ PAR / DEX /${ GDS_FILE_NAME }157 set GDS_MAP_FILE ${ PROJECT_DIR }/ PAR / DEX / gds2.map158159 # -----------------------------------------------------------------------------160 # Procedures161 # -----------------------------------------------------------------------------162163 # make_clock_tree164 #165 proc make_clock_tree create_spec {166167 global CTS_BUFFER CTS_INV CTS_SPEC_FILE CTS_RGUIDE_FILE CTS_RPT_FILE168169 if { $create_spec || ![ file exists $CTS_SPEC_FILE ] } {170 createClockTreeSpec \171 -bufFootprint $CTS_BUFFER \172 -invFootprint $CTS_INV \173 -output $CTS_SPEC_FILE174 }175 specifyClockTree -clkfile $CTS_SPEC_FILE176 ckSyn<strong>the</strong>sis \177 -rguide $CTS_RGUIDE_FILE \178 -report $CTS_RPT_FILE179 optDesign -postCTS -setup -drv -outDir PAR / RPT180181 } ;# make_clock_tree182183 # -----------------------------------------------------------------------------184 # Load configuration file185 # -----------------------------------------------------------------------------186 loadConfig $CONF_FILE 0187 commitConfig188189 # -----------------------------------------------------------------------------190 # Load IO file191 # -----------------------------------------------------------------------------192 loadIoFile $IO_FILE193194 # -----------------------------------------------------------------------------195 # Set operating conditions196 # -----------------------------------------------------------------------------197 setOpCond \198 -maxLibrary $TIM_LIBRARY -max $TIM_OC_MAX \199 -minLibrary $TIM_LIBRARY -min $TIM_OC_MIN200201 # -----------------------------------------------------------------------------202 # Set user grids203 # -----------------------------------------------------------------------------204 setPreference ConstraintUserXGrid 0.1205 setPreference ConstraintUserXOffset 0.1206 setPreference ConstraintUserYGrid 0.1207 setPreference ConstraintUserYOffset 0.1208 setPreference SnapAllCorners 1209 setPreference BlockSnapRule 220 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


210211 # -----------------------------------------------------------------------------212 # Define global Power nets - make global connections213 # -----------------------------------------------------------------------------214 clearGlobalNets215 globalNetConnect vdd ! -type pgpin -pin vdd ! -inst * -module {} -verbose216 globalNetConnect gnd ! -type pgpin -pin gnd ! -inst * -module {} -verbose217 # globalNetConnect vdd3o ! -type pgpin -pin vdd3o ! -inst * -module {} -verbose218 # globalNetConnect vdd3r1 ! -type pgpin -pin vdd3r1 ! -inst * -module {} -verbose219 # globalNetConnect vdd3r2 ! -type pgpin -pin vdd3r2 ! -inst * -module {} -verbose220 # globalNetConnect gnd3o ! -type pgpin -pin gnd3o ! -inst * -module {} -verbose221 # globalNetConnect gnd3r ! -type pgpin -pin gnd3r ! -inst * -module {} -verbose222223 # -----------------------------------------------------------------------------224 # Initialize floorplan225 # -----------------------------------------------------------------------------226 floorPlan -r $FP_ASPECT_RATIO \227 $FP_ROW_DENSITY \228 $FP_CORE2IO $FP_CORE2IO $FP_CORE2IO $FP_CORE2IO229 fit230 saveDesign $SAVE_DESIGN_FP_FILE231232 # -----------------------------------------------------------------------------233 # Create and route power rings and power stripes234 # -----------------------------------------------------------------------------235 addRing \236 -around core \237 -nets { gnd ! vdd ! } \238 -width_bottom $PR_WIDTH -width_top $PR_WIDTH \239 -width_left $PR_WIDTH -width_right $PR_WIDTH \240 -spacing_bottom $PR_SPACING -spacing_top $PR_SPACING \241 -spacing_left $PR_SPACING -spacing_right $PR_SPACING \242 -layer_bottom $PR_LAYER_TB -layer_top $PR_LAYER_TB \243 -layer_left $PR_LAYER_LR -layer_right $PR_LAYER_LR \244 -center 1 \245 -tl 1 -tr 1 -bl 1 -br 1 -lt 1 -lb 1 -rt 1 -rb 1 \246 -stacked_via_bottom_layer MET1 -stacked_via_top_layer MET4 \247 -threshold 0.7248 if { $ADD_STRIPES } {249 addStripe \250 -nets { gnd ! vdd ! } \251 -number_<strong>of</strong>_sets $ST_NUM_SETS \252 -spacing $ST_SPACING \253 -layer $ST_LAYER_V \254 -width $ST_WIDTH \255 -xleft_<strong>of</strong>fset $ST_XOFS_L256 }257 sroute \258 -jogControl { preferWithChanges differentLayer } \259 -nets { gnd ! vdd ! }260 saveDesign $SAVE_DESIGN_PR_FILE261262 # -----------------------------------------------------------------------------263 # Add CAP cells264 # -----------------------------------------------------------------------------265 addEndCap -preCap ENDCAPL -postCap ENDCAPR -prefix ENDCAP266267 # -----------------------------------------------------------------------------268 # Core cell placement269 # -----------------------------------------------------------------------------270 if { $PLACE_TIMING } {271 amoebaPlace $PL_EFFORT -timingdrivenvlsi2semicustomtutorial.tex Rev: 3, March 27, 2007 21


272 } else {273 amoebaPlace $PL_EFFORT274 }275 setDrawMode place276 saveDesign $SAVE_DESIGN_PL_FILE277278 # -----------------------------------------------------------------------------279 # Create clock tree ( optional )280 # -----------------------------------------------------------------------------281 if { $CLOCK_TREE } {282 make_clock_tree $CTS_CREATE_SPEC283 saveDesign $SAVE_DESIGN_CT_FILE284 }285286 # -----------------------------------------------------------------------------287 # Route design ( Nanoroute )288 # -----------------------------------------------------------------------------289 if { $ROUTE_TIMING } {290 setNanoRouteMode -quiet -timingEngine CTE291 setNanoRouteMode -quiet -routeWithTimingDriven true292 setNanoRouteMode -quiet -routeTdrEf<strong>for</strong>t 0293 }294 globalDetailRoute295 optDesign -postRoute -setup -drv -outDir PAR / RPT296 saveDesign $SAVE_DESIGN_RO_FILE297 setDrawMode place298299 # -----------------------------------------------------------------------------300 # Add filler cells301 # -----------------------------------------------------------------------------302 addFiller -cell $FILLER_CELLS -prefix FILLER303 saveDesign $SAVE_DESIGN_PF_FILE304305 # -----------------------------------------------------------------------------306 # Verifications307 # -----------------------------------------------------------------------------308 fillNotch -report $RPT_NOTCH_FILE309 verifyConnectivity \310 -type all \311 -error 1000 \312 -warning 50 \313 -report $RPT_CONN_FILE314 verifyGeometry \315 -allowSameCellViols \316 -allowRoutingBlkgPinOverlap \317 -allowRoutingCellBlkgOverlap \318 -report $RPT_GEOM_FILE319 verifyMetalDensity \320 -detailed \321 -report $RPT_DENSITY_FILE322323 # -----------------------------------------------------------------------------324 # Extract parasitics325 # -----------------------------------------------------------------------------326 setExtractRCMode \327 -detail \328 -rcdb $TIM_RCDB_FILE \329 -relative_c_t 0 .01 \330 -total_c_t 5.0 \331 -reduce 5332 extractRC33322 Rev: 3, March 27, 2007 vlsi2semicustomtutorial.tex


334 # -----------------------------------------------------------------------------335 # Generate RC and timing files336 # -----------------------------------------------------------------------------337 rcOut -spef $SPEF_FILE338 delayCal -sdf $SDF_FILE339340 # -----------------------------------------------------------------------------341 # Generate reports342 # -----------------------------------------------------------------------------343 reportGateCount -outfile $RPT_GATE_COUNT_FILE344345 # Timings346 #347 setCteReport348 setAnalysisMode -setup -async -skew -noClockTree -sequentialConstProp349 reportAnalysisMode350 buildTimingGraph351 checkTA -verbose > $RPT_CHECK_TA_FILE352 reportTA \353 -<strong>for</strong>mat { hpin arc cell delay arrival required slew fanout load } \354 -late \355 -max_points 10 \356 -net \357 > $RPT_REPORT_TA_FILE358359 # -----------------------------------------------------------------------------360 # Save netlist361 # -----------------------------------------------------------------------------362 saveNetlist -excludeLeafCell $VLOG_NETLIST_SIM_FILE363 saveNetlist -physical $VLOG_NETLIST_LVS_FILE364365 # -----------------------------------------------------------------------------366 # Save GDS2367 # -----------------------------------------------------------------------------368 streamOut $GDS_FILE \369 -mapFile $GDS_MAP_FILE \370 -libName ADDSUB \371 -structureName $DESIGN_NAME \372 -stripes $ST_NUM_SETS \373 -units 1000 \374 -mode ALLReferences[1] Peter J. Ashenden. The Designer’s Guide to VHDL. The Morgan Kaufmann Series in <strong>System</strong>son Silicon. Morgan Kaufmann Publishers, San Francisco, Cali<strong>for</strong>nia, USA, 2 edition, 2002. ISBN1-55860-674-2.[2] Peter J. Ashenden, Greqory D. Peterson, and Darrell A. Teegarden. The <strong>System</strong> Designer’s Guide toVHDL-AMS—Analog, Mixed-Signal, and Mixed-Technology Modeling. The Morgan Kaufmann Seriesin <strong>System</strong>s on Silicon. Morgan Kaufmann Publishers, San Francisco, Cali<strong>for</strong>nia, USA, 1 edition, 2003.[3] The Hamburg VHDL Archive. Group Technical Aspects <strong>of</strong> Multimodal <strong>System</strong>s (TAMS), University<strong>of</strong> Hamburg, Faculty <strong>of</strong> Ma<strong>the</strong>matics, In<strong>for</strong>matics and Natural Sciences, Department In<strong>for</strong>matics,Group TAMS, Vogt-Kölln-Straße 30, D-22527 Hamburg, Germany, March 2007. URL http://tams-www.in<strong>for</strong>matik.uni-hamburg.de/vhdl/.[4] Using Tcl With Synopsys R○ Tools. Synopsys, Inc., March 2003. Version U-2003.03.vlsi2_semi_custom_tutorial.tex Rev: 3, March 27, 2007 23


[5] Alain Vachoux. Top-down digital design flow. Laboratoire de Systèmes Microélectroniques (LSM),Ecole Polytechnique Fédérale de Lausanne (EPFL), EPFL/STI/IMM/LSM, Bâtiment ELD, Station 11,CH-1015 Lausanne, Switzerland, November 2006. Version 3.1.[6] Alain Vachoux. VHDL Instant. Laboratoire de Systèmes Microélectroniques (LSM), Ecole PolytechniqueFédérale de Lausanne (EPFL), EPFL/STI/IMM/LSM, Bâtiment ELD, Station 11, CH-1015 Lausanne,Switzerland, November 2006. Version 3.0.[7] Alain Vachoux. VHDL-AMS Instant. Laboratoire de Systèmes Microélectroniques (LSM), EcolePolytechnique Fédérale de Lausanne (EPFL), EPFL/STI/IMM/LSM, Bâtiment ELD, Station 11,CH-1015 Lausanne, Switzerland, March 2006. Version 3.0.24 Rev: 3, March 27, 2007 vlsi2_semi_custom_tutorial.tex

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!