WOLFRAM SYSTEM MODELER

EightBitAdderExample

Example setup of an 8-bit Adder component with integer input varying over time.

Diagram

Wolfram Language

In[1]:=
SystemModel["EducationExamples.ElectricalEngineering.EightBitAdder.EightBitAdderExample"]
Out[1]:=

Information

 

8-bit Adder - Example input

 

Introduction

Binary adders are digital circuits often used in computers for basic arithmetic operations. Using the digital package in the standard Modelica library, an 8-bit adder has been constructed that takes two 8-bit integers and calculates their sum.

 

Model Principles

The 8-bit adder model consists of eight 1-bit adders connected together in a series. The least significant bit of input a will be added together with the least significant bit of input b in the full adder located furthest to the right. Depending on the input, the adder will produce a 1-bit sum value that is the least significant bit of the result, as well as a 1-bit carry, which is sent to the next adder in the series. This is repeated in eight steps until 8 bits of output have been produced, as well as a possible carry-out signal.

The input to the calculator is varied using IntegerTable from the Modelica Standard Library. For each set of integers, the sum is calculated and simulated.

 

Simulation

To simulate the model, perform this step:

  • Click the Simulate button in the top toolbar simulate.

Plot the Results

When you run the simulation you will see the SumAndBit0 stored plot:

adderplot

The plot displays the input and output from the adder converted to a real number, as well as the input states of the first bit.

 

Parameters (2)

tableA

Value: {21, 27, 31, 20, 17, 30, 22, 17, 29, 35}

Type: Integer[:]

Description: Table of integers to add together with table B.

tableB

Value: {50, 55, 49, 42, 56, 53, 59, 52, 47, 48}

Type: Integer[:]

Description: Table of integers to add together with table A.

Components (3)

eightBitAdder

Type: Adder

Description: Component that sums integers A and B together.

integer_table_a

Type: IntegerTable

Description: Value at position A to be summed.

integer_table_b

Type: IntegerTable

Description: Value at position B to be summed.