com.github.croesch.micro_debug.mic1.alu
Class Alu

java.lang.Object
  extended by com.github.croesch.micro_debug.mic1.alu.Alu

public final class Alu
extends Object

This class represents an ALU for 32 bit values. It is based on the verilog code for 'interconnection of 1-Bit-ALUs to one 32-bit-ALU' in the script of the lecture 'Rechnertechnik' of Karl Stroetmann.

Since:
Date: Oct 18, 2011
Author:
croesch

Constructor Summary
Alu()
          Initialises all the one-bit-ALUs.
 
Method Summary
 void calculate()
          Performs calculation of the output signals based on the current values of input signals.
 int getOut()
          Returns the calculated output.
 boolean isN()
          Returns the whether the calculated output is negative.
 boolean isZ()
          Returns the whether the calculated output is zero.
 Alu setA(int a)
          Sets the value for the input value A.
 Alu setB(int b)
          Sets the value for the input value B.
 Alu setEnA(boolean enA)
          Sets the value for the signal ENA.
 Alu setEnB(boolean enB)
          Sets the value for the signal ENB.
 Alu setF0(boolean f0)
          Sets the value for the signal F0.
 Alu setF1(boolean f1)
          Sets the value for the signal F1.
 Alu setInc(boolean inC)
          Sets the value for the signal Carry in.
 Alu setInvA(boolean invA)
          Sets the value for the signal INVA.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alu

public Alu()
Initialises all the one-bit-ALUs.

Since:
Date: Oct 18, 2011
Method Detail

getOut

public int getOut()
Returns the calculated output.

Returns:
the number calculated by the ALU.
Since:
Date: Oct 18, 2011

isN

public boolean isN()
Returns the whether the calculated output is negative.

Returns:
true, if the number calculated by this ALU is less than zero.
Since:
Date: Oct 18, 2011

isZ

public boolean isZ()
Returns the whether the calculated output is zero.

Returns:
true, if the number calculated by this ALU is zero.
Since:
Date: Oct 18, 2011

setA

public Alu setA(int a)
Sets the value for the input value A.

Parameters:
a - the value of A, to calculate with
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setB

public Alu setB(int b)
Sets the value for the input value B.

Parameters:
b - the value of B, to calculate with
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setF0

public Alu setF0(boolean f0)
Sets the value for the signal F0.

Parameters:
f0 - true, if the signal should be set, false otherwise.
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setF1

public Alu setF1(boolean f1)
Sets the value for the signal F1.

Parameters:
f1 - true, if the signal should be set, false otherwise.
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setEnA

public Alu setEnA(boolean enA)
Sets the value for the signal ENA.

Parameters:
enA - true, if the signal should be set, false otherwise.
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setEnB

public Alu setEnB(boolean enB)
Sets the value for the signal ENB.

Parameters:
enB - true, if the signal should be set, false otherwise.
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setInvA

public Alu setInvA(boolean invA)
Sets the value for the signal INVA.

Parameters:
invA - true, if the signal should be set, false otherwise.
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

setInc

public Alu setInc(boolean inC)
Sets the value for the signal Carry in.

Parameters:
inC - true, if the signal should be set, false otherwise.
Returns:
instance of the Alu to allow a fluent API.
Since:
Date: Oct 18, 2011

calculate

public void calculate()
Performs calculation of the output signals based on the current values of input signals.

Since:
Date: Oct 18, 2011


Copyright © 2012. All Rights Reserved.