Skip to content

Commit

Permalink
feat(atoll): implement first cut ATOLL implementation (#357)
Browse files Browse the repository at this point in the history
* wip: atoll API

* wip

* base api

* basic port extraction

* fix integer division rounding issues

* fix lints

* expose vec of net IDs from AtollAbstract

* api for coordinate conversions

* feat(lvs-matching): LVS matching via AtollTile trait (#356)

* basic port extraction

* feat(lvs-matching): LVS matching via AtollTile trait

* work on atoll api

* fix integer division rounding issues

* fix lints

* expose vec of net IDs from AtollAbstract

* wip api

* remove unecessary changes

---------

Co-authored-by: Rahul Kumar <[email protected]>

* remove nx, ny from routing grid

* feat(atoll): convert between physical/lcm units

feat(atoll): fill sky130 nmos tile lcm bounds with nsdm and pwell

This allows proper abutment between nmos tiles.

* add sky130 pmos tile

* correct nsdm/psdm/nwell dimensions, add pmos tile to sky130 atoll

* feat(bbox): implement LayerBbox trait

The LayerBbox trait allows users to find bounding boxes
considering only the geometry on a specific LayerId.

* add track and grid helper functions for atoll

* feat(atoll): use virtual layer for tile outline

feat(atoll): make abstract generator function part of Abstract

* format

* fix lints

* fix(atoll): extend gate pin of mos tile to grid

* routing api (#359)

* fix warnings, start working on abstract merging

* basic routing api

* initial dijkstra router impl

* fix router bugs

* fix route drawing logic (#360)

* fix route drawing logic

* remove tiling

* iterative dijkstra

* debug router

* fix track dir bug in router

* hacky fix to force router to not assume same root net means connected

* format

* fix incorrect uniform tracks test

* add alignment

* fix bug in router cost function

* remove nondeterminism of router

* remove debug abstract

* feat(atoll): add sky130 ntap/ptap atoll tiles

* work on correct abstract merge

* fix drc errors in mos tile

* make signals public

* adjust li expansion to fix drc errors

* remove pwell from nmos

* revert to using pwell pin

* fix router interlayer transitions (ilts)

* add mechanism for matching nets to port geometry

* fix router bugs

* fix tap nwell

* add connected instantiation

* fix lint errors

* tweak costs, fix docs

* fix broken docs links in atoll

---------

Co-authored-by: rohanku <[email protected]>
Co-authored-by: rohanku <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2024
1 parent 264d028 commit 372b927
Show file tree
Hide file tree
Showing 30 changed files with 3,410 additions and 1,339 deletions.
68 changes: 59 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 8 additions & 15 deletions codegen/src/block/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use darling::ast::{Fields, Style};
use darling::{ast, FromDeriveInput, FromField, FromMeta, FromVariant};
use proc_macro2::TokenStream;
use quote::{format_ident, quote, ToTokens};
use syn::parse_quote;

use crate::substrate_ident;
use type_dispatch::derive::{add_trait_bounds, struct_body};
Expand Down Expand Up @@ -93,8 +92,7 @@ fn transform_field_decl(_idx: usize, field: &DataField) -> TokenStream {
ref attrs,
} = field;
let substrate = substrate_ident();
let field_ty =
quote!(#substrate::geometry::transform::Transformed<'__substrate_derive_lifetime, #ty>);
let field_ty = quote!(#substrate::geometry::transform::Transformed<#ty>);

match ident {
Some(ident) => {
Expand Down Expand Up @@ -151,12 +149,7 @@ impl ToTokens for DataInputReceiver {
quote!(#substrate::geometry::transform::HasTransformedView),
);

let lifetime: syn::GenericParam = parse_quote!('__substrate_derive_lifetime);
let mut ref_generics = generics.clone();
ref_generics.params.push(lifetime.clone());

let (imp, ty, wher) = generics.split_for_impl();
let (_ref_imp, ref_ty, _ref_wher) = ref_generics.split_for_impl();
let transformed_ident = format_ident!("{}TransformedView", ident);

let expanded = match data {
Expand All @@ -179,15 +172,15 @@ impl ToTokens for DataInputReceiver {

quote! {
#(#attrs)*
#vis struct #transformed_ident #ref_generics #body
#vis struct #transformed_ident #generics #body

impl #imp #substrate::geometry::transform::HasTransformedView for #ident #ty #wher {
type TransformedView<#lifetime> = #transformed_ident #ref_ty;
type TransformedView = #transformed_ident #ty;

fn transformed_view(
&self,
__substrate_derive_transformation: #substrate::geometry::transform::Transformation,
) -> Self::TransformedView<'_> {
) -> Self::TransformedView {
#retval
}
}
Expand All @@ -200,16 +193,16 @@ impl ToTokens for DataInputReceiver {
.map(|v| transform_variant_match_arm(transformed_ident.clone(), v));
quote! {
#(#attrs)*
#vis enum #transformed_ident #ref_generics {
#vis enum #transformed_ident #generics {
#( #decls )*
}
impl #imp #substrate::geometry::transform::HasTransformedView for #ident #ty #wher {
type TransformedView<#lifetime> = #transformed_ident #ref_ty;
type TransformedView = #transformed_ident #ty;

fn transformed_view(
&self,
__substrate_derive_transformation: #substrate::geometry::transform::Transformation,
) -> Self::TransformedView<'_> {
) -> Self::TransformedView {
match self {
#(#arms)*
}
Expand Down Expand Up @@ -277,7 +270,7 @@ impl ToTokens for HasLayoutInputReceiver {
fn layout(
&self,
io: &mut <<Self as #substrate::block::Block>::Io as #substrate::io::layout::HardwareType>::Builder,
cell: &mut #substrate::layout::CellBuilder<#pdk, Self>,
cell: &mut #substrate::layout::CellBuilder<#pdk>,
) -> #substrate::error::Result<Self::LayoutData> {

let source = { #source };
Expand Down
24 changes: 5 additions & 19 deletions codegen/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,6 @@ pub(crate) fn layout_io(input: &IoInputReceiver) -> TokenStream {

let substrate = substrate_ident();

let lifetime: syn::GenericParam = parse_quote!('__substrate_derive_lifetime);
let mut ref_generics = generics.clone();
ref_generics.params.push(lifetime.clone());
add_trait_bounds(
&mut ref_generics,
quote!(#substrate::io::layout::HardwareType),
);
add_trait_bounds(&mut ref_generics, quote!(::std::any::Any));

let mut lt_generics = generics.clone();
add_trait_bounds(
&mut lt_generics,
Expand All @@ -355,23 +346,18 @@ pub(crate) fn layout_io(input: &IoInputReceiver) -> TokenStream {
let mut hbf_generics = lt_generics.clone();

let mut idents = Vec::new();
for param in &ref_generics.params {
for param in &lt_generics.params {
if let syn::GenericParam::Type(ref type_param) = *param {
idents.push(type_param.ident.clone());
}
}
let ref_wher = ref_generics.make_where_clause();
for ident in idents {
ref_wher.predicates.push(
syn::parse_quote!(<#ident as substrate::io::layout::HardwareType>::Bundle: #lifetime),
);
hbf_generics.make_where_clause().predicates.push(syn::parse_quote!(<#ident as #substrate::io::layout::HardwareType>::Builder: #substrate::io::layout::HierarchicalBuildFrom<#substrate::layout::element::NamedPorts>));
}

let (hbf_imp, hbf_ty, hbf_where) = hbf_generics.split_for_impl();

let (_imp, ty, _wher) = generics.split_for_impl();
let (_ref_imp, ref_ty, _ref_wher) = ref_generics.split_for_impl();
let fields = data.as_ref().take_struct().unwrap();

if let Some(layout_type) = layout_type {
Expand Down Expand Up @@ -430,7 +416,7 @@ pub(crate) fn layout_io(input: &IoInputReceiver) -> TokenStream {
#declare <#field_ty as #substrate::io::layout::HardwareType>::Builder,
});
transformed_layout_data_fields.push(quote! {
#declare #substrate::geometry::transform::Transformed<#lifetime, <#field_ty as #substrate::io::layout::HardwareType>::Bundle>,
#declare #substrate::geometry::transform::Transformed<<#field_ty as #substrate::io::layout::HardwareType>::Bundle>,
});
flatten_port_geometry_fields.push(quote! {
<<#field_ty as #substrate::io::layout::HardwareType>::Bundle as #substrate::io::Flatten<#substrate::io::layout::PortGeometry>>::flatten(&#refer, __substrate_output_sink);
Expand Down Expand Up @@ -515,15 +501,15 @@ pub(crate) fn layout_io(input: &IoInputReceiver) -> TokenStream {
}

#(#attrs)*
#vis struct #transformed_layout_data_ident #ref_generics #transformed_layout_data_body
#vis struct #transformed_layout_data_ident #lt_generics #transformed_layout_data_body

impl #lt_any_imp #substrate::geometry::transform::HasTransformedView for #layout_data_ident #lt_any_ty #lt_any_where {
type TransformedView<#lifetime> = #transformed_layout_data_ident #ref_ty;
type TransformedView = #transformed_layout_data_ident #lt_ty;

fn transformed_view(
&self,
trans: #substrate::geometry::transform::Transformation,
) -> Self::TransformedView<'_> {
) -> Self::TransformedView {
#transformed_layout_data_ident #transformed_view_body
}
}
Expand Down
Loading

0 comments on commit 372b927

Please sign in to comment.