Skip to content

A Programmable Logic Array simulator written in Python, born as a Computer Architecture project.

License

Notifications You must be signed in to change notification settings

teoc98/PLAsimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLAsimulator

License: GPL

PLAsimulator is a Programmable Logic Array simulator written in Python 2.7/3.

Getting Started

Prerequisites

Necessary to rebuild the documentation:

Installation

Just clone the repo

git clone https://github.com/teoc98/PLAsimulator.git

Usage

Command line usage

python pla.py [-x x_size][-i n_inputs][-o n_outputs][-a n_and] 

Options:

  • -h, --help: show help message and exit
  • -x <x_size>: window width in pixels
  • -i <n_inputs>: number of input pins
  • -o <n_outputs>: number of output pins (equal to the number of OR gates)
  • -a <n_and>: number of AND gates

For more examples, please refer to the Documentation

Circuits library

The built-in circuits library contains by default the following circuits:

  • 1 bit half adder
  • 1 bit full adder
  • 2 bit adder
  • 6-bit ones' complement
  • 4-bit twos' complement
  • 2 bit multiplicator
  • 6 bit square root floor
  • reductor 3-2
  • multiple logic gate
  • priority encoder
  • multiplexer
  • majority
  • decoder
  • decoder 4 bit - 7 segment
  • shift register
  • comparator
  • one step flip-flop SR
  • one step flip-flop T
  • one step flip-flop JK
  • Parity check (CRC-1)
  • CRC-3-GSM

Where the CRC code generator polynomial are:

  • CRC-1: formula
  • CRC-3-GSM: formula

Circuits development

It is possible to extend the circuits library by creating new Circuit objects, using standard NumPy matrix notation.

To create a new circuit from a boolean function it is possible to use the following functions:

generate_code(name, description, function, input_names, output_names)
generate_obj(description, function, input_names, output_names)

Function generate_code prints the code to paste into the module, while function generate_obj returns a new Circuit object.

Parameters:

  • function must be a function that accepts as input a boolean n_i-tuple and returns a boolean n_o-tuple;
  • input_names must be a tuple of n_i strings;
  • output_names must be a tuple of n_o strings.

Please note that in order to add a circuit to the simulator circuit library, is necessary to add it to list circs in module circuits.py.

Notes

Unfortunately most of the user guide and documentation is in Italian only.

License

Distributed under the GNU General Public License (GNU GPL) version 3. See LICENSE for more information.

About

A Programmable Logic Array simulator written in Python, born as a Computer Architecture project.

Resources

License

Stars

Watchers

Forks