diff --git a/common/route/awooter/rust/src/lib.rs b/common/route/awooter/rust/src/lib.rs index 4e5d5319..ce1d42d7 100644 --- a/common/route/awooter/rust/src/lib.rs +++ b/common/route/awooter/rust/src/lib.rs @@ -159,9 +159,30 @@ fn route(ctx: &mut npnr::Context) -> bool { let arcs = extract_arcs_from_nets(ctx, &nets); - let (x_part, y_part, ne, se, sw, nw, misc) = partition::find_partition_point_and_sanity_check( + let mut special_arcs = vec![]; + let mut partitionable_arcs = Vec::with_capacity(arcs.len()); + for arc in arcs { + let src_name = ctx.name_of_wire(arc.get_source_wire()).to_str().unwrap(); + let dst_name = ctx.name_of_wire(arc.get_sink_wire()).to_str().unwrap(); + + if src_name.contains("FCO_SLICE") + || src_name.contains('J') + || src_name.contains("DDR") + || dst_name.contains("DDR") + { + special_arcs.push(arc); + } else { + partitionable_arcs.push(arc); + } + } + log_info!( + " {} arcs special-cased\n", + special_arcs.len().to_string().bold() + ); + + let (x_part, y_part, ne, se, sw, nw) = partition::find_partition_point_and_sanity_check( ctx, - &arcs[..], + &partitionable_arcs[..], pips, 0, ctx.grid_dim_x(), @@ -207,7 +228,7 @@ fn route(ctx: &mut npnr::Context) -> bool { Coord::new(0, 0), Coord::new(ctx.grid_dim_x(), ctx.grid_dim_y()), ); - router.route(ctx, &nets, &misc, &progress); + router.route(ctx, &nets, &special_arcs, &progress); let time = format!("{:.2}", (Instant::now() - start).as_secs_f32()); log_info!("Routing took {}s\n", time.bold()); diff --git a/common/route/awooter/rust/src/partition.rs b/common/route/awooter/rust/src/partition.rs index 7a9210e9..235f8206 100644 --- a/common/route/awooter/rust/src/partition.rs +++ b/common/route/awooter/rust/src/partition.rs @@ -83,7 +83,7 @@ pub fn find_partition_point( x_finish: i32, y_start: i32, y_finish: i32, -) -> (i32, i32, Vec, Vec, Vec, Vec, Vec) { +) -> (i32, i32, Vec, Vec, Vec, Vec) { let mut x = ((x_finish - x_start) / 2) + x_start; let mut y = ((y_finish - y_start) / 2) + y_start; let mut x_diff = (x_finish - x_start) / 4; @@ -93,10 +93,9 @@ pub fn find_partition_point( let mut se; let mut sw; let mut nw; - let mut misc; while x_diff != 0 { - (ne, se, sw, nw, misc) = partition( + (ne, se, sw, nw) = partition( ctx, arcs, pips, @@ -119,7 +118,7 @@ pub fn find_partition_point( // Stop early if Good Enough. if distortion <= 5.0 { - return (x, y, ne, se, sw, nw, misc); + return (x, y, ne, se, sw, nw); } x += match north.cmp(&south) { @@ -140,7 +139,7 @@ pub fn find_partition_point( y_diff >>= 1; } - (ne, se, sw, nw, misc) = partition( + (ne, se, sw, nw) = partition( ctx, arcs, pips, @@ -164,7 +163,7 @@ pub fn find_partition_point( 100.0 * (ne_dist + se_dist + sw_dist + nw_dist) ); - (x, y, ne, se, sw, nw, misc) + (x, y, ne, se, sw, nw) } /// finds the y location a line would be split at if you split it at a certain x location @@ -220,7 +219,7 @@ fn partition>( y: i32, x_bounds: R, y_bounds: R, -) -> (Vec, Vec, Vec, Vec, Vec) { +) -> (Vec, Vec, Vec, Vec) { let partition_coords = Coord::new(x, y); // first direction: where is this pip going @@ -238,7 +237,6 @@ fn partition>( let mut se: Vec = Vec::new(); let mut sw: Vec = Vec::new(); let mut nw: Vec = Vec::new(); - let mut misc: Vec = Vec::new(); let mut part_horiz = AtomicUsize::new(0); let mut part_vert = AtomicUsize::new(0); let mut part_diag = AtomicUsize::new(0); @@ -402,21 +400,6 @@ fn partition>( // unique_sinks.len().to_string().bold() //); - let is_special_case = |arc: &Arc| { - let src_name = ctx.name_of_wire(arc.get_source_wire()).to_str().unwrap(); - let dst_name = ctx.name_of_wire(arc.get_sink_wire()).to_str().unwrap(); - - if src_name.contains("FCO_SLICE") - || src_name.contains('J') - || src_name.contains("DDR") - || dst_name.contains("DDR") - { - return true; - } - - false - }; - let mut used_pips: HashMap>> = HashMap::new(); let mut used_wires: HashMap>> = HashMap::new(); @@ -485,12 +468,6 @@ fn partition>( let mut explored_pips = AtomicUsize::new(0); - for arc in arcs { - if is_special_case(arc) { - misc.push(arc.clone()); - } - } - let mut overused_wires = 1; while overused_wires > 0 { @@ -508,7 +485,6 @@ fn partition>( let arcs = arcs .into_par_iter() .progress_with(progress) - .filter(|arc| !is_special_case(arc)) .flat_map(|arc| { let source_loc = arc.get_source_loc(); let source_coords: Coord = source_loc.into(); @@ -841,9 +817,8 @@ fn partition>( }), dist_str(nw_dist) ); - log_info!(" {} arcs special-cased\n", misc.len().to_string().bold()); - (ne, se, sw, nw, misc) + (ne, se, sw, nw) } pub fn find_partition_point_and_sanity_check( @@ -854,8 +829,8 @@ pub fn find_partition_point_and_sanity_check( x_finish: i32, y_start: i32, y_finish: i32, -) -> (i32, i32, Vec, Vec, Vec, Vec, Vec) { - let (x_part, y_part, ne, se, sw, nw, misc) = +) -> (i32, i32, Vec, Vec, Vec, Vec) { + let (x_part, y_part, ne, se, sw, nw) = find_partition_point(ctx, arcs, pips, x_start, x_finish, y_start, y_finish); let mut invalid_arcs_in_ne = 0; @@ -921,5 +896,5 @@ pub fn find_partition_point_and_sanity_check( println!("count in nw: {}", invalid_arcs_in_nw.to_string().bold()); } - (x_part, y_part, ne, se, sw, nw, misc) + (x_part, y_part, ne, se, sw, nw) }