ordec.ord1 — ORD1 language (deprecated)

Warning

ORD1 is not recommended anymore. Use ordec.ord2 — ORD2 language instead.

ORD1 is the initial version of the IC design language in the ORDeC project. It was used to evaluate a text-based entry language for IC design within the ORDeC platform. ORD1 uses a standalone grammar different from Python, which results in a complex transformation to the Python target language. ORD1 is no longer maintained because of several compiler shortcomings, like scoping and liveness of variables, which would require a more complex semantic backend that interferes with our one-pass ORD-to-Python compiler approach. Nevertheless, this version gave us various insights into how we want to further integrate the ORD language in future versions. The examples in the project that use ORD1 are still working.

Parser

ordec.ord1.load_ord_from_string(ord_string)

Function which parses an ORD string and returns the parsed result.

Parameters:

ord_string (str) – string containing ORD code

Returns:

ast of the parsed string

Return type:

ast.AST

ordec.ord1.ord1_to_py(source_data: str) Module

Compile ORD to Python

Parameters:

source_data (str) – ORD source code

Lark Transformer

class ordec.ord1.OrdecTransformer

Transform the ORD code to ORDeC Python code

AST Transformer

class ordec.ord1.SchematicModifier(port_positions)
visit_FunctionDef(node)

Function which modifies the function_def ast - Add missing statements which where not possible to add on the first transformation

Parameters:

node (ast.Node) – current function node

Returns:

converted function node

Return type:

ast.Node

visit_ClassDef(node)

Function which modifies the class def of cell by adding the dc simulation :param node: current class node :type node: ast.Node

Returns:

converted class node

Return type:

ast.Node

Implicit Processing

ordec.ord1.preprocess(self, node, outline, port_positions)

Function which preprocesses the schematic transformation

Parameters:
  • self (Cell) – self cell reference

  • node (Node) – current node instance

  • outline (Vec2R) – outline parameters of the schematic

  • port_positions (dict) – port ref dictionary

Returns:

None

ordec.ord1.postprocess(self, node, outline, postprocess_data: PostProcess)

Function which postprocesses the schematic transformation

Parameters:
  • self (Cell) – self cell reference

  • node (Node) – current node instance

  • outline (Vec2R) – outline of the grid

  • postprocess_data (Postprocess) – dataclass for postprocess

Returns:

None

Optimize Position

ordec.ord1.get_pos_with_constraints(constraints, instances)
Information which we need to calculate the position:
  • instance list (keyword (if instance not port), type)

  • constrain (first_input, second_input, offset)

  • if a input is a tuple with multiple entries, it is a child of a instance not a port

How to calculate the positions:
  • First setup everything in their own column (for loop)

  • Maybe reserve the first column for ports and put them there in rows
    • Then look at the constraints, if there is one above each other pop from column and place below/above it

    • if left or right just swap in the column section

Parameters:
  • constraints (list) – the constraints from the parsing

  • instances (tuple) – instances with (name, type, size)

Returns:

instances with their position

Return type:

dict