CSIM Arithmetic Core Library modules

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.

  1. const_gen.sim
  2. print_data.sim
  3. add_numbers.sim
  4. subtract.sim
  5. inc_by_1.sim
  6. dec_by_1.sim
  7. inv_sign.sim
  8. multiply_numbers.sim
  9. x_divided_by_y.sim
  10. max_input.sim
  11. min_input.sim
  12. logical_if.sim
  13. split.sim
  14. combine.sim
  15. x_power_y.sim
  16. square.sim
  17. sqrt_y.sim
  18. exp_y.sim
  19. log_10_y.sim
  20. log_e_y.sim
  21. sin.sim
  22. cosine.sim
  23. tan.sim
  24. debug_on.sim
  25. debug_off.sim

See Also -

const_gen.sim Up arrow

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. const-gen1 diagram

Port

  • Input Port
    • Name: trigger
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


print_data.sim Top of the Document

Description

This module prints computed CSIM model's result. It accepts the data of inData type at its input port.

print_data diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData


add_numbers.sim Top of the Document

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.
add_numbers diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


subtract.sim Top of the Document

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.
subtract diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


inc_by_1.sim Top of the Document

Description

This module increments the input value by one and places this value on its output port.
inc_by_1 diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


dec_by_1.sim Top of the Document

Description

This module decrements its input value by one and places it on its output port.
dec_by_1 diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


inv_sign.sim Top of the Document

Description

This module changes the sign of input value and places it on its output port.
inv_sign diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


multiply_numbers.sim Top of the Document

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.
multiply_numbers diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


x_divided_by_y.sim Top of the Document

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.
x_divided_by_y diagram

Port

  • Input Port
    • Name: inx
    • Name: iny
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


max_input.sim Top of the Document

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.
max_input diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Data Type: inData
  • Output Ports
    • Name: max
    • Data Type: inData


min_input.sim Top of the Document

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.
min_input diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Data Type: inData
  • Output Ports
    • Name: min
    • Data Type: inData


logical_if.sim Top of the Document

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.
logical_if diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Data Type: inData
  • Output Ports
    • Name: true
    • Name: false
    • Data Type: inData


split.sim Top of the Document

Description

This module receives input on its input port and places the input value on all of its 3 output ports.
split diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Ports
    • Name: out1
    • Name: out2
    • Name: out3
    • Data Type: inData


combine.sim Top of the Document

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.
combine diagram

Port

  • Input Port
    • Name: in1
    • Name: in2
    • Name: in3
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


x_power_y.sim Top of the Document

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.
x_power_y diagram

Port

  • Input Port
    • Name: inx
    • Name: iny
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


square.sim Top of the Document

Description

This module implements the square of the input value and places this value on its output port.
square diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


sqrt_y.sim Top of the Document

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.
sqrt_y diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


exp_y.sim Top of the Document

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.
exp_y diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


log_10_y.sim Top of the Document

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.
log_10_y diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


log_e_y.sim Top of the Document

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.
log_e_y diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Port
    • Name: out
    • Data Type: inData


sin.sim Top of the Document

Description

This module computes the sine of the radian on its input port and places the result on its output port.
sin diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


cosine.sim Top of the Document

Description

This module computes the cosine of the radian on its input port and places the result on its output port.
cosine diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


tan.sim Top of the Document

Description

This module calculates the tangent of the radian on its input port and places the result on its output port.
tan diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


debug_on.sim Top of the Document

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.
debug_on diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData


debug_off.sim Top of the Document

Description

This module turns off the debug information of all devices connected directly to its output port or through other modules via links.
debug_off diagram

Port

  • Input Port
    • Name: in
    • Data Type: inData
  • Output Ports
    • Name: out
    • Data Type: inData