Combinatorial Logic
Implement truth table
Libraries:
Simulink /
Logic and Bit Operations
Description
The Combinatorial Logic block implements a standard truth table for modeling programmable logic arrays (PLAs), logic circuits, decision tables, and other Boolean expressions. You can use this block in conjunction with Memory blocks to implement finite-state machines or flip-flops.
Examples
Ports
Input
Port_1 — Input signal
vector
Input signal, specified as a vector. The type of signals accepted by a
Combinatorial Logic block depends on whether you
selected the Boolean logic signals option (see Implement logic signals as Boolean data (vs. double)). If
this option is enabled, the block accepts real signals of type
Boolean
or double
.
Data Types: double
| Boolean
Output
Port_2 — Output signal
scalar | vector
Output signal, double
if the truth table contains
non-Boolean values of type double
;
Boolean
otherwise. The type of the output is the
same as that of the input except that the block outputs
double
if the input is Boolean
and the truth table contains non-Boolean values.
Data Types: double
| Boolean
Parameters
Truth table — Matrix of outputs
matrix
You specify a matrix that defines all possible block outputs as the Truth table parameter. Each row of the matrix contains the output for a different combination of input elements. You must specify outputs for every combination of inputs. The number of columns is the number of block outputs.
The Truth table parameter can have Boolean values (0
or 1) of any data type, including fixed-point data types. If the table
contains non-Boolean values, the data type of the table must be
double
.
The relationship between the number of inputs and the number of rows is:
number of rows = 2(number of
inputs)
Simulink® returns a row of the matrix by computing the row's index from
the input vector elements. Simulink computes the index by building a binary number where input
vector elements having zero values are 0 and elements having nonzero values
are 1, then adding 1 to the result. For an input vector,
u
, of m
elements:
row index = 1 +
u(m)*2
0 +
u(m-1)*2
1 + ... +
u(1)*2
m-1
Programmatic Use
Block Parameter:
TruthTable |
Type: character vector |
Values: matrix |
Default: '[0 0;0 1;0
1;1 0;0 1;1 0;1 0;1 1]' |
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
See Also
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)