OpenAllegroParser - FOSS Parser for Cadence Allegro designs.

OpenAllegroParser

Purpose of this project is to provide a C++17 library for parsing Cadence's Allegro binary file formats. This library can be linked to other software for reading/modifying?/writing? Allegro binary files and reading?/writing? XML files.

See also the complementary project OpenOrCadParser.

The focus lies on

  • *.brd board database,
  • *.mdd module definition,
  • *.dra drawing,
  • *.psm package symbol,
  • *.ssm shape symbol,
  • *.fsm flash symbol,
  • *.osm format symbol,
  • *.bsm mechanical symbol, and
  • *.pad padstack.

See OrCAD Allegro Files Extension and their Contents or Cadence Allegro file Extensions and what they contain for more information on the file purpose.


Documentation

  1. *.brd Board Database
  2. *.mdd Module Definition
  3. *.dra Drawing
  4. *.psm Package Symbol
  5. *.ssm Shape Symbol
  6. *.fsm Flash Symbol
  7. *.osm Format Symbol
  8. *.bsm Mechanical Symbol
  9. *.pad Padstack

Current State — October 2021

  • Working on padstack parser.

Build

mkdir build
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build

Dependencies


Usage

./OpenAllegroParser --help
Allowed options:
  -h [ --help ]         produce help message
  -e [ --extract ]      extract files from within the binary
  -i [ --input ] arg    input file to parse
  -o [ --output ] arg   output path (required iff extract is set)

./OpenAllegroParser --input file.pad --extract --output out/
Opening file: file.pad
File contains 4960 byte.
File found at 0x00000abc: file.zip
Extract ZIP file: file.pad/file.zip
Extract from ZIP, 4200 Byte file: out/file.pad/Users/%USERNAME%/AppData/Local/Temp/#Taaaaaa00765.tmp
Closing file: file.pad

Related Projects

kicad-allegro (Rust based Allegro Extract (ASCII) to KiCad Converter and Viewer)


How to Contribute?

There are different ways to help this project forward. Some are

  • provide test files (manually created or automated via SKILL),
  • help reverse engineering/documenting the file format, or
  • implement some unit tests.

In case you don't have access to OrCAD PcbDesigner or Allegro you can get Cadence Allegro Viewer free of charge.


Cadence Terms and Conditions

Terms and Conditions

Terms of Use Agreement

Comments
  • Build Dynamic Library and use it for Unit Tests

    Build Dynamic Library and use it for Unit Tests

    • Figure out how to build the library and build an CLI application with main.cpp in one run.
    • Figure out how to link the unit tests against the dynamic library
  • Fix libzippp version and upgrade Catch

    Fix libzippp version and upgrade Catch

    libzipp produced the following error message

    /usr/bin/ld: ../vcpkg_installed/x64-linux/debug/lib/libzippp_static.a(libzippp.cpp.o): warning: relocation against `[email protected]@GLIBCXX_3.4' in read-only section `.text'
    /usr/bin/ld: ../vcpkg_installed/x64-linux/debug/lib/libzippp_static.a(libzippp.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTVN8libzippp8ZipEntryE' can not be used when making a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: bad value
    collect2: error: ld returned 1 exit status
    

    See https://github.com/ctabin/libzippp/issues/158 for the issue report

    A guide how to upgrade catch is located at https://github.com/catchorg/Catch2/blob/v3.0.1/docs/migrate-v2-to-v3.md#how-to-migrate-projects-from-v2-to-v3

  • Make usable to End Users

    Make usable to End Users

    Initial tests can be performed by users but there is still some work to do. E.g. find where the size of some dynamic structures is stored and get rid of the brute forcing Python script.

  • Unit Test Tracking

    Unit Test Tracking

    Tests that should be implemented into the CI.

    Feel free to contribute some test files. A few points to note are listed in the following.

    • If you vary a parameter e.g. an enum try to keep the rest of the parameters the same as for other variations of the same parameter. This simplifies finding the offset, when comparing two files byte-by-byte.

    • Do not use 0.0 or other values that might occur elsewhere in the file for tests. Otherwise we might misinterpret some values and the test does not detect this.

    • [ ] Units (enum)

    • [ ] Decimal places (unsigned in range [0, 4])

    • Start

      • [x] Padstack usage (enum)
    • Drill

      • Slot
        • [ ] Slot type (enum)
        • [ ] X size (unsigned)
        • [ ] Y size (unsigned)
          • X tolerance
            • [ ] +
            • [ ] -
          • Y tolerance
            • [ ] +
            • [ ] -
      • Drill hole
        • [ ] Hole type (enum)
        • [ ] Finished diameter (unsigned)
        • [ ] + Tolerance (unsigned)
        • [ ] - Tolerance (unsigned)
        • [ ] Drill tool size (string)
        • [ ] Non-standard drill (enum)
      • Hole plating
        • [ ] Hole/slot plating (enum)
      • Define the drill rows and columns
        • [ ] Number of drill rows (unsigned)
        • [ ] Number of drill columns (unsigned)
        • [ ] Clearance between columns (unsigned)
        • [ ] Clearance between rows (unsigned)
        • [ ] Drills are staggered (bool)
    • Secondary Drill

      • [ ] Backdrill (bool)
        • [ ] Diameter (unsigned)
          • Backdrill drill symbol
            • [ ] Type of drill figure (enum)
            • [ ] Characters (string with <= 3 characters)
            • [ ] Drill figure width (unsigned)
            • [ ] Drill figure height (unsigned)
      • [ ] Counter bore/sink (bool)
        • [ ] Bore type (enum)
        • [ ] Diameter (unsigned)
        • [ ] + Tolerance (unsigned)
        • [ ] - Tolerance (unsigned)
        • [ ] Depth (unsigned)
    • Drill Symbol

      • Define a drill symbol
        • [ ] Type of drill figure (enum)
        • [ ] Characters (string with <= 3 characters)
        • [ ] Drill figure width (unsigned)
        • [ ] Drill figure height (unsigned)
    • Drill Offset

      • Offset from padstack origin to hole
        • [ ] Offset x (int)
        • [ ] Offset y (int)
    • Design Layers

      • ...
    • Mask Layers

      • ...
    • Options

      • [ ] Suppress unconnected internal pads; legacy artwork (bool)
      • [ ] Lock layer span (bool)
      • [ ] Poly via (bool)
  • Data format

    Data format

    I used the board linked in the following issue to decode some board informations: https://github.com/OpenBoardView/OpenBoardView/issues/126

    In my case, I started with the lowest level of information (e.g. known tracks), thus I hardcoded "known" positions in the file to extract records as I think they might fit. I think for such binary-blobs that's the better approach, as it allows you to expand your knowlege step-wise. If you know how a record look like you can find the first one, and then the index to that record,..

    This is just a dump of information I decoded some months ago, hope it helps :smiley:

    Main Findings

    • The file is little-endian
      • degrees are stored as 4 byte little endian integers in thousands of degrees (e.g. 180° = 180000)
      • coordinates are stored as 4 byte little endian integers, first comes x and then y. Sorry, I forgot in which unit they were (but you should find this out using the kaitai file and a board-viewer)
    • I found some general "magic-byte" sequence which seemed to be the same on all files I looked on so far

    Kaitai File

    meta:
      id: allegro
      title: Allegro board file
      file-extension: brd
      endian: le
      encoding: UTF-8
    
    # Findings (27.04.2021)
    # Degree:
    #  le 4 byte 180° = 180000
    # Position x|y
    #  le 4 byte | le 4 byte
    # How found out: search for 180, 1800, 18000 until a high number of matches is found
    
    # those numbers are the same on all allegro files I saw so far:
    seq:
      - size: 3
      - id: magic
        contents: [0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00]
      - size: 44
      - id: zeroes1
        contents: [0x00, 0x00, 0x00, 0x00]
      - size: 60
      - id: zeroes2
        contents: [0x00, 0x00, 0x00, 0x00]
      - size: 36
      - id: zeroes3
        contents: [0x00, 0x00, 0x00, 0x00]
      - size: 28
      - id: zeroes4
        contents: [0x00, 0x00, 0x00, 0x00]
      - size: 28
      - id: zeroes5
        contents: [0x00, 0x00, 0x00, 0x00]
      - size: 12
      - id: string1
        type: str
        size: 60
      - size: 24
      - id: zeroes6
        contents: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
    
    instances:
      # file: 77G.MMW.automotive.radar-PCBF-V01-20180115-1520.brd
      # downloaded from https://github.com/OpenBoardView/OpenBoardView/issues/126
      
      # track_segment1: x=-18100 y=219000
      # pos: 0x25f284
      tracks_unknown:
        io: _root._io
        pos: 0x25f130  # hardcoded for now, only valid for this board
        type: tracks
    
      vias_unknown:
        io: _root._io
        pos: 0x2ea550  # hardcoded for now, only valid for this board
        type: vias
    
      # pad: 0x0032A990 - -233337 | 149000 | Pin2 | CAN_L
    
    types:
      tracks:
        seq:
          - id: tracks
            type: track_seg
            repeat-expr: 20  # just show some vias to validate record
            repeat: expr
    
      vias:
        seq:
          - id: vias
            type: via_seg
            repeat-expr: 20  # just show some vias to validate record
            repeat: expr
    
      test:
        seq:
          - id: type_question_or_layer
            type: u4
          - id: data
            size: 32+4
    
      # TODO: offsets are wrong at some point
      track_seg:  # track_seg?
        seq:
          - id: type_question_or_layer  # no idea what this is, perhaps we can extract the record type -> size from it?
            type: u4
          - size: 4*4
          - id: width  # TODO: sometimes zero?
            type: s4
          - id: start
            type: point
          - id: end
            type: point
    
    
      # TODO: offsets are wrong at some point
      via_seg:
        seq:
          - id: position
            type: point
          - size: 4*5
          - id: rotation
            type: s4
          - size: 4*9
    
      point:
        seq:
          - id: x
            type: s4
          - id: y
            type: s4
    
  • Evaluate Extracta to retrieve information from the binary files

    Evaluate Extracta to retrieve information from the binary files

    In OrCAD we can export the design into a XML which directly shows us which information is stored in the binary file and probably also how it is stored. Maybe Extracta can do the same for layouts. A short introduction how to use the tool is provided in [1]. Further, [1] states that there is a Linux version of the tool. Can this one be downloaded somewhere or why would Cadence distribute a Linux tool on an Windows machine?

    [1] BoardSurfers: Translating Allegro Database to Readable Format Using 'Extracta'

The official Allegro 5 git repository. Pull requests welcome!

Welcome to Allegro! Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such

Nov 28, 2022
Fast C/C++ CSS Parser (Cascading Style Sheets Parser)

MyCSS — a pure C CSS parser MyCSS is a fast CSS Parser implemented as a pure C99 library with the ability to build without dependencies. Mailing List:

Sep 22, 2022
A simple implementation of a parser and its use to calculate simple mathematical expressions

Calculator C Parser A simple implementation of a parser and its use to calculate simple mathematical expressions I haven't written a detailed descript

Nov 8, 2021
Lightweight C++ command line option parser

Release versions Note that master is generally a work in progress, and you probably want to use a tagged release version. Version 3 breaking changes I

Dec 1, 2022
A header only library that provides parser combinators to C++

This is an experimental C++ library for rapidly building parsers. It is inspired by parser combinators in haskell such as attoparsec and, like those libraries, allows for the construction of fully fledged parsers in a few lines of code.

Jul 24, 2022
MiWi RN Command Parser
 MiWi RN Command Parser

MiWi RN Command Parser "Wireless Made Easy!" - MiWi RN command parser based on SAMR30 and SAMR21 MiWi example code Devices: | ATSAMR30 | ATSAMR21 ⚠ Di

Sep 27, 2022
Modern C++ 20 compile time OpenAPI parser and code generator implementation

OpenApi++ : openapipp This is a proof of concept, currently under active work to become the best OpenAPI implementation for C++. It allows compile tim

Oct 13, 2022
Small Extremely Powerful Header Only C++ Lexical Analyzer/String Parser Library
Small Extremely Powerful Header Only C++ Lexical Analyzer/String Parser Library

lexpp Small Extremely Powerful Header Only C++ Lexical Analyzer/String Parser Library Lexpp is made with simplicity and size in mind. The entire libra

Jun 21, 2022
GPS parser which read raw GPS messages, selects only the valid ones and sends them to CAN bus

EagleTRT GPS System for Fenice GPS parser which read raw GPS messages, selects only the valid ones and sends them to CAN bus Compiling GPS Logger gps_

Nov 11, 2021
Ctpg - Compile Time Parser Generator

Ctpg - Compile Time Parser Generator is a C++ single header library which takes a language description as a C++ code and turns it into a LR1 table parser with a deterministic finite automaton lexical analyzer, all in compile time.

Nov 29, 2022
official repository of the muparser fast math parser library
official repository of the muparser fast math parser library

muparser - Fast Math Parser 2.3.3 (Prerelease) To read the full documentation please go to: http://beltoforion.de/en/muparser. See Install.txt for ins

Nov 18, 2022
Fast, gpu-based CSV parser

nvParse Parsing CSV files with GPU Parsing delimiter-separated files is a common task in data processing. The regular way of extracting the columns fr

Nov 9, 2022
It includes our specialized binary payload DSL (parser and schemas), clients and sdks.

Symbol Monorepo In Q1 2021, we consolidated a number of projects into this repository. It includes our specialized binary payload DSL (parser and sche

Nov 6, 2022
HLSL Parser and Translator for HLSL, GLSL, and MSL.

HLSLParser This is a fork of Unknownworld's hlslparser adapted to our needs in The Witness. We currently use it to translate pseudo-HLSL shaders (usin

Jul 2, 2022
HLSL Parser and Translator for HLSL, GLSL, and MSL.

HLSLParser This is a fork of Unknownworld's hlslparser adapted to our needs in The Witness. We currently use it to translate pseudo-HLSL shaders (usin

Nov 26, 2022
BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser) See http://pypi.python.org/pypi/bllipparser/ for Python module.

BLLIP Reranking Parser Copyright Mark Johnson, Eugene Charniak, 24th November 2005 --- August 2006 We request acknowledgement in any publications that

Nov 28, 2022
BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser)
BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser)

BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser)

Nov 28, 2022
Loki is a C++ library of designs, containing flexible implementations of common design patterns and idioms.

Last update: Novmber 16, 2005 Directions: To use Loki, simply extract the files from the archive, give your compiler access to their include path:

Dec 1, 2022
Pacman written in C++ using Allegro 5, plus Dijkstra path finder

Pacman Pacman written in C++ using Allegro 5, plus Dijkstra path finder See the interface through the Pacman image Setup Dependencies sudo apt install

May 23, 2022
Card game with Objective-C using Allegro 4/5
Card game with Objective-C using Allegro 4/5

Card game with Objective-C using Allegro 4/5 , This is an alternative of the real game for personal reasons .

Nov 7, 2021