*******************************************************************************
	MINARET (for edge-triggered circuits)

	BY

	NARESH MAHESHWARI AND SACHIN S. SAPATNEKAR

        Copyright 1998 Naresh Maheshwari and Sachin S. Sapatnekar
	All Rights Reserved
*******************************************************************************

        Source Code (in C) for retiming of edge-triggered circuits

	ASTRA is used for  minperiod retiming 
		refer to paper in DAC 95 & Tran on CAD 10/96
		by Deokar & Sapatnekar

	Minaret is used for minarea retiming
        	refer to papers in DAC 97 & Tran on VLSI 3/98 
		by Maheshwari & Sapatnekar
		
        Availiable on as is basis with no support
	Authors are not responsible for any errors

	No parts of this code may be redistributed or used in
	any commercial product without the express written
	permission of the contact person listed below.

	Contact: Sachin Sapatnekar, ECE Department,
		University of Minnesota, 200 Union Street SE,
		Minneapolis, MN 55455, USA (sachin@ece.umn.edu)


####################################################################

COMPILATION:
To compile make a directory "obj" in the current directory and run "make".
"retime" is the executable file, usage is
retime <input_file_name>  <output_file_name>  <area|period> [target_clock_period] 

USAGE:
The Program will read the circuit in modified MCNC benchmark format from the file 
"input_file_name" perform retiming on it and write the retimed circuit in output_file_name.
The input circuit should contain only edge-triggered D-type flip-flops (DFF).

If the third argument is "area", then constrained minimum area retiming is performed for the 
"target_clock_period" (if specified). If the "target_clock_period" is not given then 
unconstrained minarea retiming is performed.

If the third argument is "period" and  the "target_clock_period" is not given then 
minperiod retiming is performed. If "target_clock_period" is specified then the circuit is
retimed to meet the "target_clock_period". In either case no regard is paid to the # FF's
in the circuit.

INPUT: 
The input format is a modified MCNC benchmark format, which has a field for delay information 
for every gate. The output is also in the same format.  Input and output in the standard MCNC
format may also be availiable some time in the future. For gates that do not have delay information
the delay is set in the function set_delays (in utils.c), this function can be modified to accomodate
user needs.
The input netlist of "s27" in modified MCNC format is given at the end of this file.

PLATFORM:
The code was intially developed on HP9000 series workstations, and subciquently ported to 
DEC ALPHA, IBM RS6000 and Sun Ultra Sparc 1 workstation. Some statements to measure time 
may not port to all systems.

####################################################################
Limitations /Bugs

o Only simple edge-triggered circuits using standard D type FF's are handled.
o Every gate in the circuit should be reachable from atleast one primary input.
o Atleast one primary output should be reachable from every gate.
o This code has been tested on only ISCAS 89 benchmark circuits.
o Unconstrained minarea retiming has not been tested very well.
o ASTRA is not gauranteed to give the optimal result in minperiod retiming.
*************************************************************************************

MODIFIED MCNC FORMAT:

The modifed MCNC format contains 4 parts

s27 in modified MCNC format

INPUT G0 
INPUT G1 
INPUT G2 
INPUT G3 

OUTPUT G17 

G5   DFF G10 
G6   DFF G11 
G7   DFF G13 

G14   NOT G0 
G17   NOT G11 

G8 @1.000  AND G14  G6 

G15 @1.000  OR G12  G8 
G16  @1.000 OR G3  G8 

G9   NAND G16  G15 

G10   NOR G14  G11 
G11   NOR G5  G9 
G12   NOR G1  G7 
G13   NOR G2  G12



