From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001
From: Sven Eisenhauer Department of Electrical Engineering Finite State Machine implemented as a Mealy Machine: a non-resetting sequence recognizer. The following state diagram (Fig. 1) describes a finite state machine
+with one input X and one output Z. The FSM asserts its output Z when it
+recognizes the following input bit sequence: "1011". The machine
+will keep checking for the proper bit sequence and does not reset to the
+initial state after it has recognized the string. As an example the input
+string X= "..1011011..." will cause the output to go high twice:
+Z = "..0001001.." . When the machine is in the state S3 the output
+will go high after the arrival of a "1" at the input. Thus the
+output is associated with the transitions as indicated on the state
+diagram. Figure 1: State diagram, describing the sequence detector implemented
+as a Mealy machine. The number in italics underneath the states indicate
+which part of the sequence the state remembers. This state diagram can be described in ABEL code given in Listing 1.
+The output is described with the "With"
+keyword to indicate that the output will change when the input goes to
+one. Listing 1: ABEL source code for the Mealy Machine
+implementation of the sequence detector described in Fig. 1 module Seqdet1
+ Title 'Sequence
+Detector 1011 with Mealy Machine' Declarations X, CLOCK, RST
+PIN; "State
+register definitions SREG = [Q1,Q0];
+ Equations [Q1,Q0].AR
+= RST; "Define
+state diagram STATE_DIAGRAM
+SREG STATE S0: IF
+X THEN S1 ELSE S0; end Seqdet1 The ouput is specified with the "With" keyword. The corresponding
+simulation is shown in Figure 2. Figure 2: Simulation of the sequence detector for "1011"
+described with the state diagram of Fig. 1. (Screen clip from Xilinx XACTstep(TM)
+Foundation software) Notice that the output Z asserts as soon as the input is "1"
+when in state S3. Comparing this output with the one obtained for a Moore
+machine of the same sequence detector may let a casual observer think
+that there is a timing problem as the output seems to asserts already after
+the "101" input sequence. However, when one looks at the output
+carefully one concludes that the waveform is correct. One has to realize
+that the outputs are valid at the end of the state time (just before the
+positive clock-edge) while the valid inputs are sampled just before the
+positive clock edge as indicated in Figure 3 below. The input sequence
+"1011" gives indeed an output sequence of "0001". Figure 3: Output waveform of the Mealy machine (sequence detector
+for "1011") with valid inputs and outputs indicated. (Screen
+clip from Xilinx XACTstep(TM) Foundation software) One notices that there is a glitch in the output after the input sequence
+10111010. However this occurs at a moment that the output is not valid
+(the output is valid just before the positive clock edge). The valid output
+sequence is than 000100000 as expected. This example indicates that one has to be very careful with the timing
+when using a Mealy machine. Outputs can show glitches and are only valid
+at the end of a state time (i.e. just before the the positive clock edge
+for a positive edge triggered flip-flop or just before the negative clock
+transition for a negative egde triggered flip-flop). On the other hand
+a Mealy machine can often be implemented with fewer states that a Moore
+machine as can be seen from the Moore example.
+An alternative way to prevent glitches and to make the ouput of a Mealy
+machine synchronous with the clock, it to use a synchronous Mealy machine.
+The implementation of the sequence detector as a synchronous Mealy machine
+is given in the next example.
+
+ Department of Electrical Engineering Finite State Machine implemented as a Moore Machine: a non-resetting sequence recognizer. The following state diagram (Fig. 1) describes a finite state machine
+with one input X and one output Z. The FSM asserts its output Z when it
+recognizes the following input bit sequence: "1011". The machine
+will keep checking for the proper bit sequence and does not reset to the
+initial state after it has recognized the string. As an example the input
+string X= "..1011011..." will cause the output to go high twice:
+Z = "..0001001.." . The output will asserts only when it is in
+state S4 (after having seen the sequence 1011). The FSM is thus a Moore
+machine. Figure 1: State diagram, describing the sequence detector implemented
+as a Moore machine. The number in italics underneath the states indicate
+which part of the sequence the state remembers. This state diagram can be described in ABEL code given in Listing 1.
+The output is described after the STATE Si: statement. Listing 1: ABEL source code for the Moore machine
+implementation of the sequence detector described in Fig. 1 module Seqdet2
+ X, CLOCK, RST
+PIN; "State
+register declarations SREG = [Q2,Q1,Q0];
+ Equations [Q2,Q1,Q0].AR
+= RST; "Define
+state diagram STATE S0: Z=0;
+ STATE S1: Z=0;
+ IF X THEN S1
+ELSE S2; STATE S2: Z=0;
+ IF X THEN S3
+ELSE S0; STATE S3: Z=0;
+ IF X THEN S4
+ELSE S2; STATE S4: Z=1;
+ IF X THEN S1
+ELSE S2; end Seqdet2 The corresponding simulation is shown in Figure 2. Figure 2: Simulation of the sequence detector (for "1011")
+described with the state diagram of Fig. 1. (Screen clip from Xilinx XACTstep(TM)
+Foundation software) One notices that the output asserts after the input sequence 1011 as
+specified.
+
+ The following state diagram (Fig. 1) describes the same finite state
+machine as in the previous example: a sequence
+detector with one input X and one output Z. The FSM asserts its output
+Z when it recognizes the following input bit sequence: "1011". The machine
+will keep checking for the proper bit sequence and does not reset to the
+initial state after it has recognized the string. In contrast to the previous
+example, the machine will be implemented as a synchronous Mealy Machine.
+This will ensure that the output changes at the clock transition and will
+prevent glitches which were possible with the Mealy Machine implementation
+(see previous example).
+ Figure 1: State diagram, describing the sequence detector ("1011") implemented
+as a Mealy machine. The number in italics underneath the states indicate
+which part of the sequence the state remembers.
+
+ This state diagram can be defined in ABEL code given in Listing 1. The
+output is described with the "With" keyword
+to indicate that the output will change when the input goes to one. The
+difference with the regular Mealy machine, is that the output Z is now
+also clocked (see e.g. the statement, [Q1,Q0,Z].CLK
+=CLOCK). Also, in the State Diagram section, the "WITH Z:=0"
+makes use of the registered assignment ":=" operator.
+
+ Listing 1: ABEL source code for the Mealy Machine
+implementation of the sequence detector described in Fig. 1
+ Declarations
+ X, CLOCK, RST
+PIN;
+ "State register
+definitions
+ SREG = [Q1,Q0];
+ Equations
+ [Q1,Q0,Z].AR
+= RST;
+ "Define state
+diagram
+
+ STATE_DIAGRAM
+SREG
+
+ STATE S0: IF
+X THEN S1 ELSE S0;
+ end Syncdet1 Notice that the output Z is valid after the positive clock edge (in
+response to the input value just before the positive clock edge). The output
+asserts at the positive clock edge when the input has gone through the
+sequence "1011". Notice also that the glitch which was present in the non-synchronous
+Mealy machine is gone.
+
+ This timing in a synchronous Mealy machine is thus less critical than
+in a non-synchronous machine. The price one pays for this, is additional
+hardware. Making the output synchronous requires additional flip-flops
+as is illustrated by the blue box (Output Registers) in the generic block
+diagram of a synchronous Mealy machine in Figure 3.
+
+
+ ABEL can be used to describe the behavior of a system in a variety of
+forms, including logic equations, truth tables, and state diagrams using
+C-like statements. The ABEL compiler allows designs to be simulated and
+implemented into PLDs such as PALs, CPLDs and FPGAs.
+ Following is a brief overview of some of the features and syntax of
+ABEL. It is not intended to be a complete discussion of all its features.
+This ABEL primer will get you started with writing ABEL code. In case you
+are familiar with ABEL, this write-up can serve as a quick reference of
+the most often used commands. For more advanced features, please consult
+an ABEL manual or the Xilinx on-line documentation.
+ A typical template is given below.
+ [title string]
+ [deviceID device deviceType;]
+ pin declarations
+ other declarations
+ equations
+ equations
+ [Test_Vectors]
+ test vectors
+ end module name " input pins
+ " output pins
+ equations
+ SUM = (A & !B) # (!A & B) ;
+ end my_first_circuit;
+ Title: is optional and can
+be used to identify the project. The title name must be between single
+quotes. The title line is ignored by the compiler but is handy for documentation.
+ String: is a series of ASCII characters enclosed by single
+quotes. Strings are used for TITLE, OPTIONS statements, and in pin, node
+and attribute declarations.
+ device: this declaration is optional
+and associates a device identifier with a specific programmable logic device.
+The device statement must end with a semicolon. When you are using the
+Xilinx CAD system to compile the design, it is better not to put the device
+statement in the source file to keep your design independent of the device.
+When you create a new project in Xilinx you will specify the device type
+(can also be changed in the Project Manager window using the Project Information
+button). The format is as follows:
+ Example: MY_DECODER device 'XC4003E';
+ pin: pin declarations tell the compiler
+which symbolic names are associated with the devices external pins. Format:
+ Example:
+ IN1, IN2, A1 pin 2, 3, 4;
+ OUT1 pin 9 istype 'reg';
+ ENABLE pin;
+ !Chip_select pin 12 istype 'com';
+ !S0..!S6 pin istype 'com';
+ node: node declarations have the
+same format as the pin declaration. Nodes are internal signals which are
+not connected to external pins.
+ tmp1 node [istype 'com'];
+ Examples:
+ A = 21;
+ C=2*7;
+ ADDR = [1,0,11];
+ LARGE = B & C;
+ D = [D3, D2, D1, D0];
+ D = [D3..D0]; Examples:
+University of Pennsylvania
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"Input and output signals
+Z PIN istype 'com';
+
+Q1, Q0 PIN istype 'reg';
+
+" and assignments of state
+values
+S0 = [0,0];
+S1 = [0,1];
+S2 = [1,0];
+S3 = [1,1];
+
+"Define the clock signal for the state machine
+[Q1,Q0].CLK =CLOCK;
+
+STATE S1: IF X THEN S1 ELSE
+S2;
+STATE S2: IF X THEN S3 ELSE
+S0;
+STATE S3: IF X THEN S1 WITH
+Z=1; ELSE S2;
+
+
+
+
+
+
+
Back to ABEL Primer Contents
+| To to Common
+Mistakes list | Go to the EE
+Undergraduate Lab Homepage | Go to Xilinx
+Lab Tutorial Homepage | Go to the Foundation
+Tutorial page | Go to EE200
+or EE200 Lab
+Homepage |
+
+
Created by J. Van der Spiegel: November 16, 1997; Updated
+by J. Van der Spiegel: Dec. 30, 1997.
+
+
+
\ No newline at end of file
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2-Dateien/abel.gif b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2-Dateien/abel.gif
new file mode 100644
index 0000000..136bbc7
Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2-Dateien/abel.gif differ
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2-Dateien/abel_002.gif b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2-Dateien/abel_002.gif
new file mode 100644
index 0000000..9d3ea2c
Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2-Dateien/abel_002.gif differ
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2.html b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2.html
new file mode 100644
index 0000000..006cd54
--- /dev/null
+++ b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex2.html
@@ -0,0 +1,169 @@
+
+University of Pennsylvania
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Title 'Sequence detector implemented
+as Moore machine'
+Declarations
+"input and output signals
+Z PIN istype 'com';
+
+Q2, Q1, Q0 PIN istype 'reg';
+
+S0 = [0,0,0];
+
+S1 = [0,0,1];
+
+S2 = [0,1,0];
+
+S3 = [0,1,1];
+
+S4 = [1,0,0];
+
+"Definition of the state machine clock signal
+[Q2,Q1,Q0].CLK = CLOCK;
+
+STATE_DIAGRAM SREG
+
+
+
+
+IF X THEN S1 ELSE
+S0;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Back to ABEL Primer Contents
+| To to Common
+Mistakes list | Go to the EE
+Undergraduate Lab Homepage | Go to Xilinx
+Lab Tutorial Homepage | Go to the Foundation
+Tutorial page | Go to EE200
+or EE200 Lab
+Homepage |
+
+
Created by J. Van der Spiegel: November 16, 1997. Updated
+by J. Van der Spiegel, Nov. 19, 1997.
+
+
+
+
\ No newline at end of file
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel.gif b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel.gif
new file mode 100644
index 0000000..172aa05
Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel.gif differ
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel_002.gif b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel_002.gif
new file mode 100644
index 0000000..8e1a5c4
Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel_002.gif differ
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel_003.gif b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel_003.gif
new file mode 100644
index 0000000..c0baf6b
Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3-Dateien/abel_003.gif differ
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3.html b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3.html
new file mode 100644
index 0000000..75bb32e
--- /dev/null
+++ b/Bachelor/Digitaltechnik 2/SS07/P6/abel.ex3.html
@@ -0,0 +1,158 @@
+
+
+
+
+
+University of Pennsylvania

module Syncdet1
+
+Title 'Sequence
+Detector 1011 with a Synchronous Mealy Machine'
+
+
+The ouput is specified with the "With" keyword. The corresponding simulation
+is shown in Figure 2.
+
"Input and
+output signals
+
+
Z PIN istype
+'reg';
+
Q1, Q0 PIN
+istype 'reg';
+
+
" and assignments
+of state values
+
+
S0 = [0,0];
+
S1 = [0,1];
+
S2 = [1,0];
+
S3 = [1,1];
+
+
"Define the
+clock signal for the state machine
+
+
[Q1,Q0,Z].CLK
+=CLOCK;
+
+
STATE S1:
+IF X THEN S1 ELSE S2;
+
STATE S2:
+IF X THEN S3 ELSE S0;
+
STATE S3:
+IF X THEN S1 WITH Z:=1; ELSE S2;
+
+

Back to ABEL Primer Contents
+| To to Common
+Mistakes list | Go to the EE
+Undergraduate Lab Homepage | Go to Xilinx
+Lab Tutorial Homepage | Go to the Foundation
+Tutorial page | Go to EE200
+or EE200 Lab
+Homepage |
+
+
Created by J. Van der
+Spiegel: December 30, 1997; Updated by J. Van der Spiegel: December
+30, 1997.
+
+
\ No newline at end of file
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.primer-Dateien/abel.gif b/Bachelor/Digitaltechnik 2/SS07/P6/abel.primer-Dateien/abel.gif
new file mode 100644
index 0000000..1a3f10d
Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel.primer-Dateien/abel.gif differ
diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel.primer.html b/Bachelor/Digitaltechnik 2/SS07/P6/abel.primer.html
new file mode 100644
index 0000000..14667a2
--- /dev/null
+++ b/Bachelor/Digitaltechnik 2/SS07/P6/abel.primer.html
@@ -0,0 +1,1613 @@
+
+
+
+
+
+
+
+
+
+University of Pennsylvania
+Department of Electrical
+Engineering
+ABEL-HDL Primer
+ABEL Primer Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1 Introduction
+ABEL (Advanced Boolean Equation Language) allows you to enter behavior-like
+descriptions of a logic circuit. ABEL is an industry-standard hardware
+description language (HDL) that was developed by Data I/O Corporation for
+programmable logic devices (PLD). There are other hardware description
+languages such as VHDL and Verilog. ABEL is a simpler language than VHDL
+which is capable of describing systems of larger complexity.
+
+2. Basic structure of an ABEL source file
+An ABEL source file consists of the following elements.
+
+
+Keywords (words recognized by ABEL such as commands, e.g. goto, if, then,
+module, etc.) are not case sensitive. User-supplied names and labels (identifier)
+can be uppercase, lowercase or mixed-case, but are case-sensitive
+(input1 is different from Input1).
+module module name
+
+The following source file is an example of a
+half adder:
+module my_first_circuit;
+
+A brief explanation of the statements follow. For a more detailed discussion
+see the following sections or consult an ABEL-HDL manual. When using ABEL
+with the Xilinx CAD software, you can use the ABEL wizard which will give
+a template of the basic structure and insert some of the keywords. Also
+the Language Assistant in the ABEL editor provides on-line help. Go to
+the TOOLS ->LANGUAGE ASSISTANT menu. The Language templates give a description
+of most ABEL commands, syntax, hierarchy, etc, while the Synthesis template
+gives examples of typical circuits.
+
title 'ee200 assignment 1'
+
EE200XY device 'XC4003E';
+
+
+
A, B pin 3, 5;
+
SUM, Carry_out pin 15, 18 istype 'com';
+
Carry_out = A & B;
+
+
+3. Declarations
+Module: each source files starts with
+a module statement followed by a module name (identifier). Large source
+files often consist of multiple modules with their own title, equations,
+end statement, etc.
+device_id device 'real_device';
+
+comments: comments can be inserted anywhere in the file and
+begin with a double quote and end with another double quote or the end
+of the line, whatever comes first.
+
+
[!]pin_id pin [pin#] [istype 'attributes'] ;
+One can specify more than one pin per line:
+[!]pin_id , pin_id, pin_id pin [pin#, [pin#,
+[pin#]]] [istype 'attributes'];
+
+You do not need to specify the pin. Pin numbers can be specified later
+by using a "user constraint file " when doing the compilation using Xilinx
+CAD. This has the advantage that our design is more general and flexible.
+The ! indicates an active low (the signal will be inverted). The istype
+is an optional attribute assignment for a pin such as 'com' to indicate
+that the output is a combinational signal or 'reg' for a clocked signal
+(registered with a flip flop). This attribute is only for output pins.
+
+
Example:
+
+other declarations allows one to define constants, sets, macros
+and expressions which can simplify the program. As an example a constant
+declaration has the following format:
+
+
id [, id],... = expr [, expr].. ;
+
+The last two equations are equivalent. The use of ".." is handy to specify
+a range. The last example makes use of vector notations. Any time you use
+D in an equation, it will refer to the vector [D3, D2, D1. D0].
+
+4. Numbers
+Numbers can be entered in four different bases: binary, octal, decimal
+and hexadecimal. The default base is decimal. Use one of the following
+symbols (upper or lower case allowed) to specify the base. When no symbol
+is specified it is assumed to be in the decimal base. You can change
+the default base with the Directive "Radix" as explained in the next section.
+
+
+
+
+
+
+
+BASE NAME
+
+BASE
+
+Symbol.
+
+
+
+Binary
+
+2
+
+^b
+
+
+
+Octal
+
+8
+
+^o
+
+
+
+Decimal
+
+10
+
+^d (default)
+
+
+Hexadecimal
+
+16
+
+^h
+
+
+
+
+
+
+
+
+
+
+Specified in ABEL
+Decimal Value
+
+
+
+
+
+
+35
+
+
+35
+
+
+
+
+
+
+^h35
+
+
+53
+
+
+
+
+
+^b101
+
+
+5
+
@ALTERNATE
+
Syntax
+
@alternate
+
+
@ALTERNATE enables an alternate set of operators. Using the alternate
+operator set precludes use of the ABEL-HDL addition (+), multiplication
+(*) and division (/) operators because they represent the OR, AND and NOT
+logical operators in the alternate set. The standard operator still work
+when @ALTERNATE is in effect. The alternate operators remain in effect
+until the @STANDARD directive is used or the end of the module is reached.
+
@RADIX
+
Syntax
+
@radix expr ;
+
Expr: A valid expression that produces the number 2, 8,
+10 or 16 to indicate a new default base number.
+
The @Radix directive changes the default base. The default is base 10 +(decimal). The newly-specified default base stays in effect until another +@radix directive is issued or until the end of the module is reached. Note +that when a new @radix is issued, the specification of the new base must +be in the current base format +
Example +
@radix 2; +“change default base to binary ++ +
… +
@radix 1010; “change back from binary +to decimal
@STANDARD
+
Syntax
+
@standard
+
The @standard option resets the operators to the ABEL-HDL standard.
+The alternate set is chosen with the @alternative directive.
+
+
+
A set is a list of constants or signals separated by commas or the range +operator (..) put between square brackets (required). +
+
|
+
++ |
+
|
+
+" incrementing range | +
+
|
+
+" decrementing range | +
+
|
+
++ |
+
|
+
+" range within a larger set | +
+
|
+
+"decrementing range of active -low signals | +
However, the following is not allowed: [D0, X]; +
[D0, X3..X0];
X2 = [X3..X0]; "set declaration +
X2 := D1[3..0]; "makes X2 equal to [D3, D2, D1, +D0] +
X2 := D1[7..4]; "makes X2 equal to [D7, D6, D5, +D4]
Example 1: +
Signal = [1,0,1] & [0,1,1];" results in Signal +being "equal to [0,0,1]
B = C & D;
is equivalent to: [A1,B1] = [D1 & C3, D2 & +C2]; +
thus A1 = D1 & C3, and B1= D2 & C2.
B=[B2,B1,B0]; "set declaration +
A # B; is equivalent to [A2 +# B2, A1 # B1, A0 # B0]; +
!A; is equivalent to [!A2,!A1,!A0];
Example 7: Sets are also handy to specify logic equations. Suppose you +need to specify the equation: +
Example 8: +
For the same constants as in the example above, the expression, +
[0 & A7, 1 & A6, 1 & A5] +
[0,A6,A5].
| Operator (default) | + +Description | + +Alternate operator | +
| ! | + +NOT (ones complement) | + +/ | +
| & | + +AND | + +* | +
| # | + +OR | + ++ | +
| $ | + +XOR: exclusive or | + +:+: | +
| !$ | + +XNOR: exclusive nor | + +:*: | +
| Operator | + +Example | + +Description | +
| - | + +-D1 | + +Twos complement (negation) | +
| - | + +C1-C2 | + +Subtraction | +
| + | + +A+B | + +Addition | +
|
+ |
+||
| * | + +A*B | + +Multiplication | +
| / | + +A/B | + +Unsigned integer division | +
| % | + +A%B | + +Modulus: remainder of A/B | +
| << | + +A<<B | + +Shift A left by B bits | +
| >> | + +A>>B | + +Shift B right by B bits | +
| Operator | + +Example | + +Description | +
| == | + +A==B or 3==5 (false) | + +Equal | +
| != | + +A!=B or 3 != 5 (true) | + +Not equal | +
| < | + +A<B or 3 < 5 (true) | + +Less than | +
| <= | + +A<=B or 3 <= 5 (true) | + +Less than or equal | +
| > | + +A>B or -1 > 5 (true) | + +Greater than | +
| >= | + +A>=B or !0 >= 5 (true) | + +Greater than or equal | +
Relational operators are unsigned. +Be careful: !0 is the one complement of 0 or 11111111 (8 bits data) which +is 255 in unsigned binary. Thus !0 > 9 is true. The expression -1>5 is +true for the same reason. +
A relational expression can be used whenever a number can be used. The +-1 or 0 will be substituted depending on the logical result. As an example +: +
Q1 := D;
| Operator | + +Description | +
| = | + +Combinational assignment | +
| := | + +Registered assignment | +
| Priority | + +Operator | + +Description | +
| 1 | + +- | + +Negation (twos complement) | +
| 1 | + +! | + +NOT | +
| 2 | + +& | + +AND | +
| 2 | + +<< | + +shift left | +
| 2 | + +>> | + +shift right | +
| 2 | + +* | + +multiply | +
| 2 | + +/ | + +unsigned division | +
| 2 | + +% | + +modulus | +
| 3 | + ++ | + +add | +
| 3 | + +- | + +subtract | +
| 3 | + +# | + +OR | +
| 3 | + +$ | + +XOR | +
| 3 | + +!$ | + +XNOR | +
| 4 | + +== | + +equal | +
| 4 | + +!= | + +not equal | +
| 4 | + +< | + +less then | +
| 4 | + +<= | + +less then or equal | +
| 4 | + +> | + +greater than | +
| 4 | + +>= | + +greater than or equal | +
The "When-Then-Else" statement +is used in equations to describe a logic function. (Note: "If +-Then-Else" is used in the State-diagram section to describe state +progression). +
The format of the "When-Then-Else" statement is as follows: +
ELSE equation; +
or +
WHEN condition THEN equation;
WHEN (A == B) THEN D1_out = A1; +
inputs -> outputs ;
inputs :> reg_outs ;
( in_ids :> reg_ids -> out_ids ) +
inputs :> reg_outs -> outputs ;
+
Example 1: half adder +
Truth tables can also be used to define sequential machines. Lets implement +a three-bit up counter which counts from 000, 001, to 111 and back to 000. +Lets call QA, QB and QC the outputs of the flip-flops. In addition, we +will generate an output OUT whenever the counter reaches the state 111. +We will also reset the counter to the state 000 when the reset signal is +high. +
CLOCK pin; " input
+signal
+
RESET . pin; "
+input signal
+
OUT pin istype 'com'; "
+output signal (combinational)
+
QC,QB,QA pin istype 'reg'; " output signal
+(registered)
+
[QC,QB,QA].CLK = CLOCK; "FF clocked on the
+CLOCK input
+
[QC,QB,QA].AR = RESET; "asynchronous reset
+by RESET
+
TRUTH_TABLE ) [QC, QB, QA] :> [QC,QB,QA] -> +OUT) +
State declaration (in the declaration section) syntax: +
The syntax for State_diagram is as follows: +
STATE state_value : [equation;] +
[equation;] +
: +
: +
trans_stmt ; ...
The STATE keyword and following statements describe one state of the +state diagram and includes a state value or symbolic state name, state +transition statement and an optional output equation. In the above syntax, +
This statement is used in the state_diagram section to describe the +next state and to specify mutually exclusive transition conditions. +
Syntax: +
[ELSE state_exp] ;
Example (after R. Katz): +
in the declaration section we define first the state registers: +
state_diagram SREG
+
state S0: OUT1 = 1;
+
state INIT: if RESET then INIT else LOOK; +
state LOOK: if REST than INIT +
Syntax: +
This statement can be used with the "If-Then-Else", "Goto" or "Case" +statements in place of a simple state expression. The "With" statement +allows the output equations to be written in terms of transitions. +
Example 1: +
Example 2: +
Example 3[1]: +
state S1: +
Example 3: +
Syntax: +
[ expression : state_exp; ]
+
:
+
ENDCASE ;
Example: +
The syntax is +
| Dot extension | + +Description | +
| Architecture independent or pin-to-pin extensions | +|
| .ACLR | + +Asynchronous register reset | +
| .ASET | + +Asynchronous register preset | +
| .CLK | + +Clock input to an edge-triggered flip-flop | +
| .CLR | + +Synchronous register reset | +
| .COM | + +Cominbational feedback from flip-flop data input | +
| .FG | + +Register feedback | +
| .OE | + +Output enable | +
| .PIN | + +Pin feedback | +
| .SET | + +Synchronous register preset | +
| Device Specific extensions (architecture +dependent) | +|
| .D | + +Data input to a D Flip flop | +
| .J | + +J input to a JK flip-flop | +
| .K | + +K input to a JK flip-flop | +
| .S | + +S input to a SR flip-flop | +
| .R | + +R input to a SR flip-flop | +
| .T | + +T input to a T flip-flop | +
| .Q | + +Register feedback | +
| .PR | + +Register preset | +
| .RE | + +Register reset | +
| .AP | + +Asynchronous register preset | +
| .AR | + +Asynchronous register reset | +
| .SP | + +Synchronous register preset | +
| .SR | + +Synchronous register reset | +
The figure below illustrates some of the extensions. +
+
+
+
+
Figure 1: Illustration of DOT extensions for: (a) an architecture independent +(pin-to-pin) and (b) arhitecture dependent D-type (or T-type) Flip Flop +Architecture
Example 1: +
Example 2: +
[Z.ar, Q.ar] = reset;
Syntax: +
(input [, input ].. -> output [, output ] .. ) +
[invalues -> outvalues ; ]
+
:
+
:
( [A, B] -> [Sum, Carry] ) +
[ 0, 0 ] -> [0, 0];
+
[ 0, 1 ] -> [1, 0];
+
[ 1, 0 ] -> [1, 0];
+
[ 1, 1 ] -> [1, 1];
( [A, B] -> [Sum, Carry] ) +
( [CLK, RESET, A, B ] -> [ Y0, Y1, Y3] ) +
A, B pin ; +
!OUT pin istype 'com'; +
equations +
OUT = A & !B # !A & B ; +
end
A, B pin ; +
OUT pin istype 'com'; +
equations +
!OUT = A & !B # !A & B ; +
end
!X = A & !B # !A & B;
Created by J. Van der Spiegel, +<jan@ee.upenn.edu> Sept. 26, 1997; Updated August 13, 1999 +
\ No newline at end of file diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip new file mode 100644 index 0000000..7c9c28a Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/add1b.abl b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/add1b.abl new file mode 100644 index 0000000..52e7827 --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/add1b.abl @@ -0,0 +1,26 @@ +MODULE adder_1bit + +TITLE 'Volladdierer mit Carry' + +DEClARATIONS + Bit_1 pin 15; // I/O 0, input + Bit_2 pin 16; // I/O 1, input + C_in pin 17; // I/O 2, input + + Sum pin 29 istype 'com'; // I/O 12, output kombinatorisch + C_out pin 30 istype 'com'; // I/O 13, output kombinatorisch + + +TRUTH_TABLE ( [Bit_1,Bit_2,C_in] -> [Sum,C_out] ) // Wahrheitstabelle des Volladdierers + + [0 ,0 ,0 ] -> [0 ,0 ]; + [0 ,0 ,1 ] -> [1 ,0 ]; + [0 ,1 ,0 ] -> [1 ,0 ]; + [0 ,1 ,1 ] -> [0 ,1 ]; + [1 ,0 ,0 ] -> [1 ,0 ]; + [1 ,0 ,1 ] -> [0 ,1 ]; + [1 ,1 ,0 ] -> [0 ,1 ]; + [1 ,1 ,1 ] -> [1 ,1 ]; + +END + diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/count4b1.abl b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/count4b1.abl new file mode 100644 index 0000000..257cd94 --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/count4b1.abl @@ -0,0 +1,25 @@ +MODULE Counter_4_bit + +TITLE '0 ... 9, version with equations' + +DEClARATIONS + clk pin 15; " I/O 0, Eingang für den Takt + rst pin 16; " I/O 1, Eingang für das Reset Signal + ce pin 17; " I/O 2, Eingang für das Enable Signal + q3,q2,q1,q0 pin 29,30,31,32 istype 'reg'; " I/O 12, 13, 14, 15, Ausgang: Bits des Zählers, 15: 2^0 + carry pin 44 istype 'reg'; // I/O 23, Ausgang für Carry + +" bus definition, vector, register + counter = [q3,q2,q1,q0]; + +EQUATIONS + counter.clk = clk; + counter.ar = rst; + carry.clk = clk; + when (ce & (counter < 9)) then counter := counter + 1; + else when (ce & (counter >= 9)) then {counter := 0; carry := 1;} + else counter := counter; + + +END + diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/count4b2.abl b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/count4b2.abl new file mode 100644 index 0000000..545d92b --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/abel_samples.zip_FILES/count4b2.abl @@ -0,0 +1,71 @@ +MODULE Counter_4_bit +TITLE '0 ... 9, version with state diagram' +DEClARATIONS + clk pin 15; " I/O 0, Eingang für den Takt + rst pin 16; " I/O 1, Eingang für das Reset Signal + ce pin 17; " I/O 2, Eingang für das Enable Signal + q3,q2,q1,q0 pin 29,30,31,32 istype 'reg'; " I/O 12, 13, 14, 15, Ausgang: Bits des Zählers, 15: 2^0 + carry pin 44 istype 'reg'; // I/O 23, Ausgang für Carry + +" bus definition, vector, register + counter = [q3,q2,q1,q0]; + +EQUATIONS + counter.clk = clk; + carry.clk = clk; + +STATE_DIAGRAM counter; + State 0: + if(!rst & ce) then 1; " Bei Erfüllung der Bedingung erfolgt ein Übergang in State 1 + else 0; + State 1: + if (rst) then 0; + else if (ce) then 2; + else 1; + State 2: + if (rst) then 0; + else if (ce) then 3; + else 2; + State 3: + if (rst) then 0; + else if (ce) then 4; + else 3; + State 4: + if (rst) then 0; + else if (ce) then 5; + else 4; + State 5: + if (rst) then 0; + else if (ce) then 6; + else 5; + State 6: + if (rst) then 0; + else if (ce) then 7; + else 6; + State 7: + if (rst) then 0; + else if (ce) then 8; + else 7; + State 8: + if (rst) then 0; + else if (ce) then 9; + else 8; + State 9: + carry := 1; + if (rst) then 0; + else if (ce) then 0; + else 9; + State 10: + goto 0; " es erfolgt ein bedingungsloser Übergang in State 0 + State 11: + goto 0; + State 12: + goto 0; + State 13: + goto 0; + State 14: + goto 0; + State 15: + goto 0; +END + diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/intro2k.pdf b/Bachelor/Digitaltechnik 2/SS07/P6/intro2k.pdf new file mode 100644 index 0000000..25ee5a8 Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/intro2k.pdf differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/ispLever_Kurzanleitung.pdf b/Bachelor/Digitaltechnik 2/SS07/P6/ispLever_Kurzanleitung.pdf new file mode 100644 index 0000000..3ed22c3 Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/ispLever_Kurzanleitung.pdf differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6.odt b/Bachelor/Digitaltechnik 2/SS07/P6/p6.odt new file mode 100644 index 0000000..f3088c7 Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6.odt differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-state.dia b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-state.dia new file mode 100644 index 0000000..fb7b6da Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-state.dia differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-state.png b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-state.png new file mode 100644 index 0000000..29489f0 Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-state.png differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-statetab.ods b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-statetab.ods new file mode 100644 index 0000000..619fcaf Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1-statetab.ods differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a1.abl b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1.abl new file mode 100755 index 0000000..739e7a5 --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1.abl @@ -0,0 +1,95 @@ +MODULE ampel1 +TITLE 'Ampelsteuerung 1, state diagram' +DEClARATIONS + clk pin 15; " I/O 0, Eingang für den Takt + rst pin 16; " I/O 1, Eingang für das Reset Signal + ce pin 17; " I/O 2, Eingang für das Enable Signal + vg,vy,vr,fg,fr pin 25,26,27,28,29 istype 'reg'; " I/O 8,9,10,11,12 + +" bus definition, vector, register + ampel = [vg,vy,vr,fg,fr]; + +EQUATIONS + ampel.clk = clk; + +STATE_DIAGRAM ampel; + State 0: + if(!rst & ce) then 17; " Bei Erfüllung der Bedingung erfolgt ein Übergang in State 17 + else 0; + State 1: + goto 0; " es erfolgt ein bedingungsloser Übergang in State 0 + State 2: + goto 0; + State 3: + goto 0; + State 4: + goto 0; + State 5: + goto 0; + State 6: + if (rst) then 0; + else if (ce) then 13; + else 0; + State 7: + if (rst) then 0; + else if (ce) then 8; + else 7; + State 8: + if (rst) then 0; + else if (ce) then 9; + else 8; + State 9: + if (rst) then 0; + else if (ce) then 6; + else 0; + State 10: + goto 0; " es erfolgt ein bedingungsloser Übergang in State 0 + State 11: + goto 0; + State 12: + goto 0; + State 13: + if (rst) then 0; + else if (ce) then 17; + else 0; + State 14: + goto 0; + State 15: + goto 0; + State 16: + goto 0; + State 17: + if (rst) then 0; + else if (ce) then 9; + else 0; + State 18: + goto 0; + State 19: + goto 0; + State 20: + goto 0; + State 21: + goto 0; + State 22: + goto 0; + State 23: + goto 0; + State 24: + goto 0; + State 25: + goto 0; + State 26: + goto 0; + State 27: + goto 0; + State 28: + goto 0; + State 29: + goto 0; + State 30: + goto 0; + State 31: + goto 0; + +END + diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a1b.abl b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1b.abl new file mode 100755 index 0000000..c3846ce --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/p6a1b.abl @@ -0,0 +1,41 @@ +MODULE ampel1 +TITLE 'Ampelsteuerung 1, state diagram' +DEClARATIONS + clk pin 15; " I/O 0, Eingang für den Takt + rst pin 16; " I/O 1, Eingang für das Reset Signal + ce pin 17; " I/O 2, Eingang für das Enable Signal + vg,vy,vr,fg,fr pin 25,26,27,28,29 istype 'reg'; " I/O 8,9,10,11,12 + state0 node istype 'reg'; + state1 node istype 'reg'; + +" bus definition, vector, register + ampel = [vg,vy,vr,fg,fr]; + states =[state0,state1]; + +EQUATIONS + ampel.clk = clk; + states.clk = clk; + +STATE_DIAGRAM states; + State 0: + ampel:=17; + if(!rst & ce) then 1; " Bei Erfüllung der Bedingung erfolgt ein Übergang in State 1 + else 0; + State 1: + ampel:=9; + if (rst) then 0; + else if (ce) then 2; + else 0; + State 2: + ampel:=6; + if (rst) then 0; + else if (ce) then 3; + else 0; + State 3: + ampel:=13; + if (rst) then 0; + else if (ce) then 0; + else 0; + +END + diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-state.dia b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-state.dia new file mode 100644 index 0000000..b71dd0a Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-state.dia differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-state.png b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-state.png new file mode 100644 index 0000000..749d261 Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-state.png differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-statetab.ods b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-statetab.ods new file mode 100644 index 0000000..4eba64e Binary files /dev/null and b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2-statetab.ods differ diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a2.abl b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2.abl new file mode 100755 index 0000000..9f8f11f --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2.abl @@ -0,0 +1,96 @@ +MODULE Ampel2 +TITLE 'Ampelsteuerung state diagram' +DEClARATIONS + clk pin 15; " I/O 0, Eingang für den Takt + rst pin 16; " I/O 1, Eingang für das Reset Signal + ce pin 17; " I/O 2, Eingang für das Enable Signal + taste pin 18; " I/O 3, Eingang für das Tasten-Signal + vg,vy,vr,fg,fr pin 25,26,27,28,29 istype 'reg'; " I/O 8,9,10,11,12 + +" bus definition, vector, register + ampel = [vg,vy,vr,fg,fr]; + +EQUATIONS + ampel.clk = clk; + +STATE_DIAGRAM ampel; + State 0: + if(!rst & ce) then 17; " Bei Erfüllung der Bedingung erfolgt ein Übergang in State 17 + else 0; + State 1: + goto 0; " es erfolgt ein bedingungsloser Übergang in State 0 + State 2: + goto 0; + State 3: + goto 0; + State 4: + goto 0; + State 5: + goto 0; + State 6: + if (rst) then 0; + else if (ce) then 13; + else 0; + State 7: + if (rst) then 0; + else if (ce) then 8; + else 7; + State 8: + if (rst) then 0; + else if (ce) then 9; + else 8; + State 9: + if (rst) then 0; + else if (ce) then 6; + else 0; + State 10: + goto 0; " es erfolgt ein bedingungsloser Übergang in State 0 + State 11: + goto 0; + State 12: + goto 0; + State 13: + if (rst) then 0; + else if (ce) then 17; + else 0; + State 14: + goto 0; + State 15: + goto 0; + State 16: + goto 0; + State 17: + if (rst) then 0; + else if (ce) then 9; + else 0; + State 18: + goto 0; + State 19: + goto 0; + State 20: + goto 0; + State 21: + goto 0; + State 22: + goto 0; + State 23: + goto 0; + State 24: + goto 0; + State 25: + goto 0; + State 26: + goto 0; + State 27: + goto 0; + State 28: + goto 0; + State 29: + goto 0; + State 30: + goto 0; + State 31: + goto 0; + +END + diff --git a/Bachelor/Digitaltechnik 2/SS07/P6/p6a2.xcf b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2.xcf new file mode 100755 index 0000000..5f380be --- /dev/null +++ b/Bachelor/Digitaltechnik 2/SS07/P6/p6a2.xcf @@ -0,0 +1,53 @@ + + +