Skip to main content

A powerful tool to build, test, and analyse multiplier designs.

Project description

Introduction

Multiplied is a library for exploring and quickly defining combinational multiplication algorithms. The library also bundles built-in tools to analyse and visualise algorithms through Pandas and Matplotlib.

The Problem

Generating and analysing multiplier designs by hand is labour intensive, even for small datasets, for entire truth tables it's close to impossible.

Multiplied is built to streamline this process:

  • Custom partial product reduction via templates
  • Generating complete truth tables
  • Analysis, plotting, and managing datasets
  • Fine-grain access to bits, words or stages

Pattern Based Algorithm

Multiplied uses Algorithm objects to store each stage of reduction. Each of which is made up of a Template, pseudo Matrix, and a Map.

  • Patterns represent simple templates
  • Automatic mapping based on empty rows
  • "Pseudo" matrix to visualise possible bit positions for arithmetic outputs.
m = mp.Matrix(8)
p = mp.Pattern(['a','a','b','b','c','c','d','d'])
alg = mp.Algorithm(m)
alg.push(p)
print(alg)
0:{

template:{

________AaAaAaAa
_______aAaAaAaA_
______BbBbBbBb__
_____bBbBbBbB___
____CcCcCcCc____
___cCcCcCcC_____
__DdDdDdDd______
_dDdDdDdD_______

______AaAaAaAaAa
________________
____BbBbBbBbBb__
________________
__CcCcCcCcCc____
________________
DdDdDdDdDd______
________________
}

pseudo:{

______AaAaAaAaAa
____BbBbBbBbBb__
__CcCcCcCcCc____
DdDdDdDdDd______
________________
________________
________________
________________
}

map:{

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD FD
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
}

Automatic Template Generation

Extend the previous single stage, pattern based algorithm using auto resolution:

alg.auto_resolve_stage(recursive=True)

Algorithm Execution

With the algorithm object complete, you can execute it with the following code:

result = alg.exec(42, 255)

for m in result.values():
    print(m)

# convert result to decimal
print(int("".join(alg.matrix.matrix[0]), 2))
print(a*b)
________00101010
_______00101010_
______00101010__
_____00101010___
____00101010____
___00101010_____
__00101010______
_00101010_______

______0011010110
______00010100__
___0011010110___
___00010100_____
0001111110______
________________
________________
________________

___0011000110110
_____00110100___
00100010000_____
________________
________________
________________
________________
________________

0010010110010110
__0001000100____
________________
________________
________________
________________
________________
________________

0010100111010110
________________
________________
________________
________________
________________
________________
________________

10710
10710

Analysis

Generated data returns as a Pandas DataFrame ready for manipulation and visualisation:

import pandas as pd

domain_ = (1, 255)  # range of possible operand values for a and b
range_ = (1, 65535)  # range of possible output values
scope = mp.truth_scope(domain_, range_)  # generator clamps range to domain

# scope yields input tuples (a, b) to generate a Pandas DataFrame
df = mp.truth_dataframe(scope, alg)

# Generate cumulative heatmap of all stages
mp.df_global_heatmap("example.svg", "Fancy Title", df, dark=True)

# Generate and stack 2d heatmaps of each stage
mp.df_global_3d_heatmap("example3d.svg", "Fancy Title", df, dark=True)

Example 8-bit Wallace Tree Heatmap

Example 8-bit Wallace Tree 3D Heatmap

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multiplied-0.7.3.tar.gz (45.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multiplied-0.7.3-py3-none-any.whl (59.8 kB view details)

Uploaded Python 3

File details

Details for the file multiplied-0.7.3.tar.gz.

File metadata

  • Download URL: multiplied-0.7.3.tar.gz
  • Upload date:
  • Size: 45.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for multiplied-0.7.3.tar.gz
Algorithm Hash digest
SHA256 3d66221f64885f137b710211d0138441df8bd6176d232bf4679fc9c7b365fe9a
MD5 f085ad9fcacf06647e0cfe802464593c
BLAKE2b-256 a41c1ff0a1643e9afbd96405daa3d991a0c2337360dfb50dd88606ab37927cfb

See more details on using hashes here.

File details

Details for the file multiplied-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: multiplied-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 59.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for multiplied-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fe5486c8598a8afc9e7de8ad8699205bcc9a38312ab4237059aa7e3ae7694009
MD5 ec0aed1adfd0dc2b2c1a12395d7b02e7
BLAKE2b-256 892fbc57dcef228b0b637e03d6fb391cf51d8b3e220371e041732b036a899581

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page