CSIM Arithmetic Core Library modules
CSIM Arithmetic Core library contains a total of 25 modules. The modules are
listed below. Each module is briefly described on the following pages. To use
these modules, you must include/import csim_arith.h file. This file includes
data structure definitions, global function definitions, and parameters needed
by the modules to function properly. Each CSIM arithmetic core library module
executes only when its input/inputs have been received. The library provides
two different mechanisms to control the amount of debugging information available
to the user. The DEBUG variable, specified in csim_arith.h C preprocessor
file, displays information for the entire system whereas debug_on module
enables the information for those devices connected directly to its output port
or through other devices via links.
- const_gen.sim
- print_data.sim
- add_numbers.sim
- subtract.sim
- inc_by_1.sim
- dec_by_1.sim
- inv_sign.sim
- multiply_numbers.sim
- x_divided_by_y.sim
- max_input.sim
- min_input.sim
- logical_if.sim
- split.sim
- combine.sim
- x_power_y.sim
- square.sim
- sqrt_y.sim
- exp_y.sim
- log_10_y.sim
- log_e_y.sim
- sin.sim
- cosine.sim
- tan.sim
- debug_on.sim
- debug_off.sim
See Also -
const_gen.sim
Description
This CSIM module generates a constant number of integer, float or double type and
places this value on its output port. The input value is specified by using
one of the 3 key words in the instance name of CSIM device box. The key words are
#INTEGER_, #FLOAT_ or #DOUBLE_. For example, to generate a double value of 9865.1243
change the "Instance Name:" field of const_gen box to #DOUBLE_9865.1243 .
For subsequent regeneration of the same constant number, the module needs to be
triggered on its trigger input port.
Port
- Input Port
- Name: trigger
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
print_data.sim
Description
This module prints computed CSIM model's result. It accepts the data of inData
type at its input port.
Port
- Input Port
- Name: in
- Data Type: inData
add_numbers.sim
Description
This module adds inData type received on its inputs ports and places their
sum on the output port. The models does not add data till both inputs are
received.
Port
- Input Port
- Name: in1
- Name: in2
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
subtract.sim
Description
This module subtracts the data of inData type received on its port and places their
difference on the output port. The models does not subtract data till both inputs are
received.
Port
- Input Port
- Name: in1
- Name: in2
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
inc_by_1.sim
Description
This module increments the input value by one and places this value on its output
port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
dec_by_1.sim
Description
This module decrements its input value by one and places it on its output
port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
inv_sign.sim
Description
This module changes the sign of input value and places it on its output
port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
multiply_numbers.sim
Description
This module multiplies the data on its inputs, in1 and in2, and places their
product on the output port. The models does not multiply the data till both inputs are
received. The mismatch data type on its input port are handled by the module and
product is promoted according to C's promotion rules.
Port
- Input Port
- Name: in1
- Name: in2
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
x_divided_by_y.sim
Description
This module divides the value on its port, inx by the value on its port, iny.
The mismatch of the data type received on its
input port is handled by the module according toC's promotion rules. The
division result is placed on its output port. If the denominator value ( y = ) is
zero then module generates an error message and halts the simulation.
Port
- Input Port
- Name: inx
- Name: iny
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
max_input.sim
Description
This module selects the largest value received on its input ports and places it
on its output port.
The mismatch of the data type received on its
input ports is handled by the module according to C's promotion rules.
Port
- Input Port
- Name: in1
- Name: in2
- Data Type: inData
- Output Ports
- Name: max
- Data Type: inData
min_input.sim
Description
This module selects the smallest value received on its input ports and places it
on its output port.
The mismatch of the data type received on its
input ports is handled by the module according to C's promotion rules.
Port
- Input Port
- Name: in1
- Name: in2
- Data Type: inData
- Output Ports
- Name: min
- Data Type: inData
logical_if.sim
Description
This module compares the input values and performs logical if operation.
If input value on port in1 is greater than the value on in2, it sends a value
of positive 1 on output port true and -1 on output
port false . Conversely, it sends a value
of -1 on output port true and positive 1 on output
port false . The value on output ports are always opposite to each other.
The mismatch of the data type received on its
input ports is handled by the module according to C's promotion rules.
Port
- Input Port
- Name: in1
- Name: in2
- Data Type: inData
- Output Ports
- Name: true
- Name: false
- Data Type: inData
split.sim
Description
This module receives input on its input port and places the input value
on all of its 3 output ports.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Ports
- Name: out1
- Name: out2
- Name: out3
- Data Type: inData
combine.sim
Description
This module receives inputs on its input ports and places the input value
on its output port in the same order as they are received. The module
continuously monitors and receives inputs
in any sequence on its input ports.
Port
- Input Port
- Name: in1
- Name: in2
- Name: in3
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
x_power_y.sim
Description
This module computes the function x raised to the power y of the value received on its
input ports inx and iny respectively. The mismatch of the data type received on its
input port is handled by the module according toC's promotion rules. The
calculated value is placed on its output port.
Port
- Input Port
- Name: inx
- Name: iny
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
square.sim
Description
This module implements the square of the input value
and places this value on its output port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
sqrt_y.sim
Description
This module computes the square root of the input value
and places this value on its output port. If the input is negative then an error
message is generated on the window from where the simulation is initiated and
the simulation is halted for user to review the erroneous data.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
exp_y.sim
Description
This module implements the function exp(y). The constant e (2.71..) is raised to
the power specified by its input value. The computed value is placed on its output
port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
log_10_y.sim
Description
This module performs the computation of function log(y) to the base 10 of its
input value and places the computed value on its output port. If the input value
is negative, the module generates an error message and halts the simulation for
user to review the data.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
log_e_y.sim
Description
This module performs the computation of function log(y) to the base e of the value
received on its input port and places this value on its output port. If the input value
is negative, the module generates an error message and halts the simulation for
user to review the data.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Port
- Name: out
- Data Type: inData
sin.sim
Description
This module computes the sine of the radian on its input port and places the
result on its output port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
cosine.sim
Description
This module computes the cosine of the radian on its input port and places the
result on its output port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
tan.sim
Description
This module calculates the tangent of the radian on its input port and places the
result on its output port.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
debug_on.sim
Description
This module turns on the debug information. The debug information is shown on both
the window from where the simulation is initiated and on the CSIM window. The module
enables the debug information of all the devices connected directly to its output
port or
through other modules via links. This module differs from DEBUG variable specified
in the csim_arith.h C preprocessor directive file. This variable enables
the debug information for the entire system being simulated.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
debug_off.sim
Description
This module turns off the debug information of all devices connected
directly to its output port or through other modules via links.
Port
- Input Port
- Name: in
- Data Type: inData
- Output Ports
- Name: out
- Data Type: inData
|