🔍 Left Edge Algorithm Basics
Problem: You have a set of horizontal nets (wires) that need to be routed in a channel, connecting terminals on the top and bottom of the channel. Each net spans from a leftmost column to a rightmost column.
Assumptions:
-
One routing layer (usually horizontal).
-
No doglegs (i.e., each net must be assigned to a single horizontal track).
-
Each track can carry multiple nets, but only if they don't overlap.
-
Vertical connections (vias) are made at terminal positions.
LEA Steps:
-
Sort all nets by their left edge (i.e., starting column) in increasing order.
-
Initialize an empty set of tracks.
-
For each net in sorted order:
-
Try to assign it to the lowest-numbered track where it does not overlap with any net already on that track.
-
If no such track is found, create a new track and assign the net there.
-
📦 Example Input Format
Let’s say each net is defined by its left and right span (columns it needs to go from/to):
// Nets: (NetID, LeftEdge, RightEdge)
Net0: (0, 1, 5)Net1: (1, 2, 6)Net2: (2, 4, 8)Net3: (3, 0, 2)Net4: (4, 7, 9)
Sort by LeftEdge:
Net3 (0,2), Net0 (1,5), Net1 (2,6), Net2 (4,8), Net4 (7,9)
Routing (greedy LEA assignment):
-
Track 0: Net3, Net1, Net4
-
Track 1: Net0, Net2
🧠 Verilog Implementation?
The LEA is usually implemented in a software language (C++, Python, etc.) for physical design tools, not Verilog, since Verilog is for hardware description.
But, if you really want to simulate the LEA logic in Verilog as a behavioural model (just for educational purposes), you could do something like:
🔧 Pseudo-Verilog (Behavioural Modelling)
module left_edge_router;
integer i, j;parameter NUM_NETS = 5;parameter MAX_TRACKS = 10;// Net definition: [left_edge][right_edge]integer left[0:NUM_NETS-1];integer right[0:NUM_NETS-1];integer track_assignment[0:NUM_NETS-1];integer track_ends[0:MAX_TRACKS-1];initial begin// Define net intervalsleft[0] = 1; right[0] = 5;left[1] = 2; right[1] = 6;left[2] = 4; right[2] = 8;left[3] = 0; right[3] = 2;left[4] = 7; right[4] = 9;// Initializefor (i = 0; i < NUM_NETS; i = i + 1)track_assignment[i] = -1;for (i = 0; i < MAX_TRACKS; i = i + 1)track_ends[i] = -1;// Sort by left edge (simple bubble sort for illustration)integer temp_l, temp_r;for (i = 0; i < NUM_NETS; i = i + 1) beginfor (j = i + 1; j < NUM_NETS; j = j + 1) beginif (left[i] > left[j]) begintemp_l = left[i]; temp_r = right[i];left[i] = left[j]; right[i] = right[j];left[j] = temp_l; right[j] = temp_r;endendend// Left Edge Algorithmfor (i = 0; i < NUM_NETS; i = i + 1) beginfor (j = 0; j < MAX_TRACKS; j = j + 1) beginif (track_ends[j] < left[i]) begintrack_assignment[i] = j;track_ends[j] = right[i];break;endendend// Print assignmentsfor (i = 0; i < NUM_NETS; i = i + 1)$display("Net %0d assigned to Track %0d", i, track_assignment[i]);$finish;endendmodule
🧪 Output (Expected):
Net 3 assigned to Track 0
Net 0 assigned to Track 1
Net 1 assigned to Track 0
Net 2 assigned to Track 1
Net 4 assigned to Track 0
No comments:
Post a Comment