Spaces:
Sleeping

XCos_MCP / data /help /Integer_pal /LOGIC.xml
xcos-bot
Deploy snapshot from 23aafd1a (verified archive)
39e01c4
Raw History Blame Contribute Delete
14.6 kB
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Xcos
*
* Copyright (C) INRIA - METALAU Project <scicos@inria.fr> (HTML version)
* Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version)
* Copyright 2011 - Bernard DUJARDIN <bernard.dujardin@contrib.scilab.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* See the file ./license.txt
*
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
xml:id="LOGIC" xmln.mml="http://www.w3.org/1998/Math/MathML" xml:lang="en_US">
<refnamediv>
<refname>LOGIC</refname>
<refpurpose>Combinatorial Logic</refpurpose>
</refnamediv>
<refsection>
<title>Block Screenshot</title>
<inlinemediaobject>
<imageobject>
<imagedata fileref="../../../../images/palettes/LOGIC.png" align="center"/>
</imageobject>
</inlinemediaobject>
</refsection>
<refsection id="Contents_LOGIC">
<title>Contents</title>
<itemizedlist>
<listitem>
<xref linkend="Description_LOGIC">Description</xref>
</listitem>
<listitem>
<xref linkend="Data_Type_LOGIC">Data types</xref>
</listitem>
<listitem>
<xref linkend="Dialogbox_LOGIC">Parameters</xref>
</listitem>
<listitem>
<xref linkend="Defaultproperties_LOGIC">Default properties</xref>
</listitem>
<listitem>
<xref linkend="Interfacingfunction_LOGIC">Interfacing function</xref>
</listitem>
<listitem>
<xref linkend="Computationalfunction_LOGIC">Computational function</xref>
</listitem>
<listitem>
<xref linkend="Examples_LOGIC">Examples</xref>
</listitem>
<listitem>
<xref linkend="Seealso_LOGIC">See also</xref>
</listitem>
</itemizedlist>
</refsection>
<refsection id="Description_LOGIC">
<title>Description</title>
<para>
This block implements a standard truth table for modeling programming array, digital circuit and any other boolean expressions.
</para>
<para>
The user must specify a matrix that defines all the possible block outputs in the
<emphasis role="bold">Truth Table</emphasis> field. In consequence, the number of rows must be a power of two.
Each row of the matrix contains a logic combination of input elements.
</para>
<para>
Setting the parameter <emphasis role="bold">Truth Table</emphasis> defines the number of inputs
and outputs in the following way :
</para>
<itemizedlist>
<listitem>
<para>
The number of inputs is defined by the equation:
</para>
<para>
<emphasis>Number_of_lines =
2<superscript>(Number of inputs)</superscript></emphasis>
</para>
</listitem>
<listitem>
<para>
The number of outputs is equal to the number of columns of the matrix.
</para>
</listitem>
</itemizedlist>
<para>
This block can be activated by an implicit input event or it can inherit the clock
from the regular input (parameter <emphasis role="bold">Accepts Inherited Events</emphasis>).
</para>
</refsection>
<refsection id="Data_Type_LOGIC">
<title>Data types</title>
<para>
The block supports the following types :
</para>
<itemizedlist>
<listitem>
<para>
Input : scalar. All Scilab's integer data type.
</para>
<para>
A positive input is considered as logical 1, a negative or a null input as logical 0.
</para>
</listitem>
<listitem>
<para>
Output : same type and dimensions than input.
</para>
</listitem>
</itemizedlist>
</refsection>
<refsection id="Dialogbox_LOGIC">
<title>Parameters</title>
<inlinemediaobject>
<imageobject>
<imagedata fileref="../../../gui/integer_pal/en_US/LOGIC_gui.png" align="center" style="float:right"/>
<!-- align => Javahelp, style => Online -->
</imageobject>
</inlinemediaobject>
<itemizedlist>
<listitem>
<para>
<emphasis role="bold">Truth Table</emphasis>
</para>
<para>
The matrix of outputs. The elements must be 0 or 1. For more information see the description part.
</para>
<para> Properties : Type 'mat' of size [-1,-2]. </para>
</listitem>
<listitem>
<para>
<emphasis role="bold">Accepts Inherited Events (0:No, 1:Yes)</emphasis>
</para>
<para> Specifies if the clock is inherit or not. 0 or 1</para>
<para> Properties : Type 'vec' of size 1.</para>
</listitem>
</itemizedlist>
</refsection>
<refsection id="Defaultproperties_LOGIC">
<title>Default properties</title>
<itemizedlist>
<listitem>
<para>
<emphasis role="bold">always active:</emphasis> no
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">direct-feedthrough:</emphasis> yes
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">zero-crossing:</emphasis> no
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">mode:</emphasis> no
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">regular inputs:</emphasis>
</para>
<para>
<emphasis role="bold">- port 1 : size [1,1] / type 5</emphasis>
</para>
<para>
<emphasis role="bold">- port 2 : size [1,1] / type 5</emphasis>
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">regular outputs:</emphasis>
</para>
<para>
<emphasis role="bold">- port 1 : size [1,1] / type 5</emphasis>
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">number/sizes of activation inputs:</emphasis> 1
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">number/sizes of activation outputs:</emphasis> 0
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">continuous-time state:</emphasis> no
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">discrete-time state:</emphasis> no
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">object discrete-time state:</emphasis> no
</para>
</listitem>
<listitem>
<para>
<emphasis role="bold">name of computational function:</emphasis>
<emphasis role="italic">logic</emphasis>
</para>
</listitem>
</itemizedlist>
<para/>
</refsection>
<refsection id="Examples_LOGIC">
<title>Examples</title>
<refsect3 id="Example_1_LOGIC">
<title>Example 1</title>
<para>
The easiest example to consider is the OR example.In this case we have two inputs
and only one output. The truth table for this example is :
</para>
<informaltable border="1" cellpadding="3">
<tr>
<td><emphasis role="bold">input 1</emphasis></td>
<td><emphasis role="bold">input 2</emphasis></td>
<td><emphasis role="bold">output</emphasis></td>
</tr>
<tr><td>0</td><td>0</td><td>0</td></tr>
<tr><td>0</td><td>1</td><td>1</td></tr>
<tr><td>1</td><td>0</td><td>1</td></tr>
<tr><td>1</td><td>1</td><td>1</td></tr>
</informaltable>
<para>
and the <emphasis role="bold">Truth Table</emphasis> parameter is writing
<literal>[0 ; 1 ; 1 ; 1]</literal>.
</para>
</refsect3>
<refsect3 id="Example_2_LOGIC">
<title>Example 2</title>
<para>
This example shows the use of LOGIC bloc as a demultiplexer. The goal is to send
the true constant input on one of the four outputs according to the state of the
two selection inputs:
<emphasis><literal>a</literal></emphasis> and <emphasis><literal>b</literal></emphasis>.
The truth table is the following:
</para>
<informaltable border="1" cellpadding="3">
<tr>
<td><emphasis role="bold">Constant</emphasis></td>
<td><emphasis role="bold">a</emphasis></td>
<td><emphasis role="bold">b</emphasis></td>
<td><emphasis role="bold">Q0</emphasis></td>
<td><emphasis role="bold">Q1</emphasis></td>
<td><emphasis role="bold">Q2</emphasis></td>
<td><emphasis role="bold">Q3</emphasis></td>
</tr>
<tr><td>0</td><td>X</td><td>X</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td></tr>
<tr><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td></tr>
<tr><td>1</td><td>1</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td></tr>
</informaltable>
<para>where <emphasis><literal>X</literal></emphasis> stands for "indifferent".</para>
<para>
To set this table in the <emphasis role="bold">Truth Table</emphasis> parameter, we can
simply write:
</para>
<programlisting role="example"><![CDATA[
[zeros(4,4) ; eye(4,4)]
]]></programlisting>
<para>
The following figure shows the resulting outputs
<emphasis><literal>Q<subscript>0</subscript></literal></emphasis> to
<emphasis><literal>Q<subscript>3</subscript></literal></emphasis>
during the simulation when the selection
inputs <emphasis><literal>a</literal></emphasis> and
<emphasis><literal>b</literal></emphasis> are generated by a binary counter.
</para>
<para>
<link type="scilab" linkend="scilab.xcos/xcos/examples/integer_pal/en_US/LOGIC_en_US.zcos">
<inlinemediaobject>
<imageobject>
<imagedata fileref="../../../../examples/integer_pal/en_US/LOGIC_en_US.zcos" align="center"/>
</imageobject>
</inlinemediaobject>
</link>
</para>
<scilab:image><![CDATA[
importXcosDiagram(SCI + "/modules/xcos/examples/integer_pal/en_US/LOGIC_en_US.zcos");
xcos_simulate(scs_m, 4);
]]></scilab:image>
</refsect3>
</refsection>
<refsection id="Interfacingfunction_LOGIC">
<title>Interfacing function</title>
<itemizedlist>
<listitem>
<para>
<link type="scilab" linkend="scilab.scinotes/scicos_blocks/macros/IntegerOp/LOGIC.sci">SCI/modules/scicos_blocks/macros/IntegerOp/LOGIC.sci</link>
</para>
</listitem>
</itemizedlist>
</refsection>
<refsection id="Computationalfunction_LOGIC">
<title>Computational function</title>
<itemizedlist>
<listitem>
<para> SCI/modules/scicos_blocks/src/c/logic.c</para>
</listitem>
</itemizedlist>
</refsection>
<refsection role="see also" xml:id="Seealso_LOGIC">
<title>See also</title>
<simplelist type="inline">
<member>
<link linkend="BITSET">BITSET</link>
</member>
<member>
<link linkend="BITCLEAR">BITCLEAR</link>
</member>
<member>
<link linkend="LOGICAL_OP">LOGICAL_OP</link>
</member>
<member>
<link linkend="EXTRACTBITS">EXTRACTBITS</link>
</member>
</simplelist>
</refsection>
</refentry>