RegisterTransfer RT Synthesis Greg Stitt ECE Department University

  • Slides: 33
Download presentation
Register-Transfer (RT) Synthesis Greg Stitt ECE Department University of Florida

Register-Transfer (RT) Synthesis Greg Stitt ECE Department University of Florida

Introduction n Register-transfer (RT) synthesis n Definition: Synthesis from register transfer level (RTL) descriptions

Introduction n Register-transfer (RT) synthesis n Definition: Synthesis from register transfer level (RTL) descriptions n n VHDL, Verilog typically describe circuits as connections of RTL components What are register-transfer level components? n n Muxes, ALUs, registers, multipliers, etc. One abstraction level above gates n n Basically, components you use in most structural descriptions What are other levels? n n n Transistor level Gate level Register transfer level High level System level Etc.

RT Synthesis n Main Steps n Lex/Parsing n n Resource Allocation n n n

RT Synthesis n Main Steps n Lex/Parsing n n Resource Allocation n n n Maps intermediate representation into RT components Optimizations n n Analyzes HDL, converts into intermediate representation Logic minimization State encoding Etc. Technology Mapping Placement + Routing

Technology Mapping n Converts circuit from one technology (e. g. gates) onto technology used

Technology Mapping n Converts circuit from one technology (e. g. gates) onto technology used by physical device (e. g. LUTs, CLBs, etc) CLB CLB CLB

Placement n Input: Technology-mapped circuit n n For simplicity, just consider CLBs Technology-mapped circuit

Placement n Input: Technology-mapped circuit n n For simplicity, just consider CLBs Technology-mapped circuit consists of “virtual” CLBs and “virtual” connections FPGA fabric consists of physical CLBs Simplified Placement Definition: n Map “virtual” CLBs onto physical CLBs n I. e. Decide on a location in the FPGA for each virtual CLB Technology Mapped Circuit 1 2 5 3 FPGA Fabric 4 Possible Placement CLB CLB CLB 1 2 3 4 CLB CLB CLB 5 CLB 6 CLB CLB CLB 6

Routing n n Input: A set of placed components, and a list of “virtual”

Routing n n Input: A set of placed components, and a list of “virtual” connections Simplified Routing Definition: Determine how to configure routing resources to implement “virtual” connections n 1 2 3 4 CLB 5 CLB 6 CLB CLB Physical CLBs not connected – must configure routing resources to implement these connections: 1 2 5 3 4 6

Placement+Routing (PAR) n Placement and routing highly dependent n n Placement affects how well

Placement+Routing (PAR) n Placement and routing highly dependent n n Placement affects how well circuit can be routed Example: Placement 1 1 2 5 3 4 Placement 2 1 2 3 4 CLB 6 3 CLB 1 CLB 5 CLB 6 CLB CLB 4 CLB CLB 2 CLB CLB 5 6 Clearly, placement 1 is easier to route

Placement+Routing (PAR) n Goals: n 1) Make sure circuit can be implemented on fabric

Placement+Routing (PAR) n Goals: n 1) Make sure circuit can be implemented on fabric n n n 2) Minimize delay of critical path n n n Trivial for placement, difficult for routing Bad placement may make circuit unroutable Critical path is the longest register to register delay Important - Determines clock speed of circuit Why is placement and routing important? n Bad PAR = slow circuit n Even worse, BAD PAR = no circuit Placement 2 Placement 1 1 2 3 4 CLB 6 3 CLB 1 CLB 5 CLB 6 CLB CLB 4 CLB CLB 2 CLB CLB 5 Even if routing is possible, placement 2 likely to have longer wires – slower clock

Placement n n Problem: Find a placement for each CLB, such that routing can

Placement n n Problem: Find a placement for each CLB, such that routing can maximize clock speed Challenges: n 1) Huge solution space! n Tiny Example: Fabric = 100 physical CLBs, Circuit = 10 “virtual” CLBs n n Possibilities = 100! / 90! = 6. 2 * 1019 And, that is for a tiny fabric and tiny circuit!!!!!! Guess what … placement is NP-Complete 2) How to know how good the routing will be? n One (im)possibility - perform routing for each possible placement n n Tiny example, cont. - assume same number of routing possibilities as placement possibilities 6. 2 * 1019 * 6. 2 * 1019 = A BIG NUMBER! Routing is also NP-complete Cleary, placement needs to estimate quality of routing n Estimate known as a cost function

Cost Function Examples n Example: average wire length n Motivation: short wires faster than

Cost Function Examples n Example: average wire length n Motivation: short wires faster than long wires n Not perfect - many short wires not on critical path may lead to inaccuracy n n i. e. critical path may still be long despite short average wire length How to determine wire length? n n Without routing, don’t know length Possibilities: n 1) Euclidian distance - measure straight line distance between CLBs n n CLB CLB CLB Manhattan Distance CLB CLB CLB Ignores how wire would be routed (can’t route diagonals) 2) Manhattan distance - shortest “zig-zag” distance n Euclidian Distance Includes bends between CLBs

Placement Techniques n Placement is an NP-complete optimization problem n n n Many possible

Placement Techniques n Placement is an NP-complete optimization problem n n n Many possible placements, we want the best one What does this suggest for a solution? Remember last lecture! n 1) Branch and bound n n n 2) Map to other NP-complete problem - use heuristic for that problem 3) Use general optimization heuristics n n n Likely not feasible Simulated annealing (very common) Hill climbing How to use general optimization heuristics? n n Cost function represents quality of placement Neighboring solution – try new location for a “virtual” CLB, swap 2 CLBs, etc.

Placement Techniques n n Also common to map placement to other NPcomplete problems Example:

Placement Techniques n n Also common to map placement to other NPcomplete problems Example: Min-cut problem n n Background: Given a graph, a cut is a set of edges that divides the graph into two (or more) groups Min-cut problem definition: n n Find the minimum cut size for a given graph Similar to graph bipartitioning problem Cutsize = 5 Cutsize = 3

Placement Techniques n How can graph bipartitioning/min-cut be used for placement? n n Graph:

Placement Techniques n How can graph bipartitioning/min-cut be used for placement? n n Graph: Nodes are CLBs, Edges are wires Partition divides FPGA into sections n n Bipartitioning attempts to reduce routing “congestion” n n Goal: minimize communication between sections i. e. Cost function is cut size We can use common heuristic for graph bipartitioning n Kernighan-Lin (KL) Heuristic

Placement Techniques n KLFM Heuristic (Kernighan-Lin Fiduccia-Mattheyses) n Basic Idea: n n Start with

Placement Techniques n KLFM Heuristic (Kernighan-Lin Fiduccia-Mattheyses) n Basic Idea: n n Start with initial partition Iteratively improves cutsize n n Moves one node at a time n n n Cutsize is number of edges between partitions Node that gives greatest reduction or least degradation Lock node after moving Continue moving nodes until all locked or size constraints are violated Find best partitioning, unlock all nodes Repeat until no improvement found

KLFM Algorithm Initial Partition Maximum Size = 4 Size = 3 Cutsize = 5

KLFM Algorithm Initial Partition Maximum Size = 4 Size = 3 Cutsize = 5

KLFM Algorithm Maximum Size = 4 Size = 2 Cutsize = 3

KLFM Algorithm Maximum Size = 4 Size = 2 Cutsize = 3

KLFM Algorithm Maximum Size = 4 Size = 3 Cutsize = 2

KLFM Algorithm Maximum Size = 4 Size = 3 Cutsize = 2

KLFM Algorithm Maximum Size = 4 Size = 2 Size = 4 Cutsize =

KLFM Algorithm Maximum Size = 4 Size = 2 Size = 4 Cutsize = 2

KLFM Algorithm Maximum Size = 4 Size = 3 Cutsize = 4

KLFM Algorithm Maximum Size = 4 Size = 3 Cutsize = 4

KLFM Algorithm Maximum Size = 4 Size = 2 Size = 4 Cutsize =

KLFM Algorithm Maximum Size = 4 Size = 2 Size = 4 Cutsize = 4

KLFM Algorithm Maximum Size = 4 Size = 3 Cutsize = 5

KLFM Algorithm Maximum Size = 4 Size = 3 Cutsize = 5

KLFM Algorithm Backtrack to minimum cut size, unlock nodes, and repeat Size = 3

KLFM Algorithm Backtrack to minimum cut size, unlock nodes, and repeat Size = 3 Cutsize = 2

Circuit Partitioning n How does a partition help us place CLBs? n n Apply

Circuit Partitioning n How does a partition help us place CLBs? n n Apply bipartitioning hierarchically – circuit partitioning Basic idea n 1) Initially divide FPGA into 2 sections n n 2) Divide each section into 2 subsections n n n Execute bipartitioning to determine which section “virtual” CLBs get mapped into Execute bipartitioning to determine which subsection “virtual” CLBs get mapped into 3) Divided each subsection into 2 subsubsections And so on

Placement Summary n n Definition: Map “virtual” CLB onto physical CLBs, such that routing

Placement Summary n n Definition: Map “virtual” CLB onto physical CLBs, such that routing can maximize clock frequency Need way of estimating routing quality – cost function n Wire length n n Cutsize n n n Typically leads to shorter wires, but may cause congestion Helps with congestion, but may result in long wires Existing approaches are typically a combination NP-Complete Optimization Problem n n Can use many existing heuristics Simulated annealing, KL are common

Routing n Definition: Given a placement and a set of “virtual” connections, implement connections

Routing n Definition: Given a placement and a set of “virtual” connections, implement connections using routing resources such that clock speed is maximized n n Clearly another optimization problem n n n i. e Figure out how to configure connection boxes and switch boxes in most efficient way Huge number of possible routing solutions, we want the best one Routing is NP-Complete What does this suggest? n 1) Branch and bound n n n Likely not feasible 2) Map to other NP-complete problem - use heuristic for that problem 3) Use general optimization heuristics n n Simulated annealing Hill climbing Genetic algorithms Etc.

Routing: Background n Routing algorithms sometimes performed in 2 stages n n Global routing

Routing: Background n Routing algorithms sometimes performed in 2 stages n n Global routing determines channels to be used for each connection (“net”) n n n Ignores low-level details of C/S boxes Focuses on finding a short paths that minimize congestion Detail routing determines low-level connections used by each C/S box n n Global and detail routing Uses coarse route provided by global router Analogy: Driving directions n n Global routing: Take 34 th to Archer to 13 th, etc. Detailed routing: Get in the right lane, wait at the light, turn left, change into the right lane, etc.

Maze Routing n Input: n Grid structure representing routing resources n n Set of

Maze Routing n Input: n Grid structure representing routing resources n n Set of source and destination terminals n n Each box represents a terminal or a routing resource Defines end points of each connection Problem definition: Find the shortest route for each pair of source and destination terminals Each box is either a terminal or a routing resource

Maze Routing n Lee’s Algorithm: n 1) Expansion – find shortest path from src

Maze Routing n Lee’s Algorithm: n 1) Expansion – find shortest path from src to dest that avoids used resources n n Done using breadth first search Essentially determines shortest distance of each box from the source, until the dest is found Terminals 2 2 1 1 2 2

Maze Routing n Lee’s Algorithm, Cont. : n n n 2) Traceback – Follow

Maze Routing n Lee’s Algorithm, Cont. : n n n 2) Traceback – Follow path from dest with decreasing labels (shortest path to src) n May be multiple paths 3) Repeat 1+2 for each net Really good animation at: n https: //cadapplets. lafayette. edu/index. html

Maze Routing n n Another example Main Weakness: n n Quality of routing depends

Maze Routing n n Another example Main Weakness: n n Quality of routing depends on ordering of nets How to determine best ordering? n Too many possibilities, generally not feasible Routing blue before purple gives shorter wire length

Pathfinder n Pathfinder [Ebeling, et al. , 1995] n n Introduced negotiated congestion n

Pathfinder n Pathfinder [Ebeling, et al. , 1995] n n Introduced negotiated congestion n Ordering independent During each routing iteration, route nets using shortest path n n 1 1 1 Allows overuse (congestion) of routing resources 1 If congestion exists (illegal routing) n n Update cost of congested resources based on the amount of overuse Rip-up all routes and reroute all nets 1 congestion 12 1

Versatile Place&Route (VPR) n Versatile Place&Route (VPR) [Betz] takes as input a description of

Versatile Place&Route (VPR) n Versatile Place&Route (VPR) [Betz] takes as input a description of the fabric n n n 2 variations of VPR n n n Describe routing resources, etc. Could potentially be used for many FPGAs – “versatile” Routability driven – find an implementation that uses the fewest routing resources Timing driven – maximize clock speed Placement/routing technique n Modified version of Pathfinder Uses cost function based on fabric description n Details: http: //www. eecg. toronto. edu/~vaughn/vpr. html n

Summary n RT Synthesis creates circuit from RT-level description n n 3 important steps

Summary n RT Synthesis creates circuit from RT-level description n n 3 important steps – Technology mapping, Placement, Routing Technology mapping converts gate-level (or other level) representation to CLBs, DSPs, etc. Placement finds a physical CLB for each mapped CLB Routing configures routing resources to connect CLBs Placement and Routing are NP-Complete n Need heuristics n n Placement – Simulated annealing, KL, etc. Routing – Maze, Pathfinder, VPR