Professional Documents
Culture Documents
DEPARTMENT OF ENGINEERING
BENG(HONS) ELECTRICAL AND ELECTRONICS ENGINEERING
ELECTRONICS SYSTEM DESIGN
LAB REPORT
Contents
Contents...............................................................................................................................................2
DESIGN FILE.....................................................................................................................................3
Results.................................................................................................................................................3
LAB 2 : 3 Bit Down Counter..............................................................................................................4
DESIGN FILE.....................................................................................................................................4
Results.................................................................................................................................................5
LAB 3 : 3 Bit Ring Counter................................................................................................................5
Design File..........................................................................................................................................5
Results.................................................................................................................................................6
LAB 4 : Ramdom Pattern Generator...................................................................................................6
Design File..........................................................................................................................................6
Results.................................................................................................................................................7
LAB 5 : Even/Odd Parity Checker.....................................................................................................7
DESIGN FILE.....................................................................................................................................7
Results.................................................................................................................................................8
LAB 6 : Sequence Detector.................................................................................................................8
Design File..........................................................................................................................................8
Results.................................................................................................................................................9
LAB 7 : Vending Machine..................................................................................................................9
Design file...........................................................................................................................................9
LAB 8 : Traffic light controller.........................................................................................................12
Design file.........................................................................................................................................12
Results...............................................................................................................................................13
Simulation.........................................................................................................................................14
LAB
BIT
BINARY
TO
GRAY
CODE
MAPPING
DESIGN FILE
/* *************** INPUT PINS *********************/
PIN
I0
; /*
*/
PIN
I1
; /*
*/
PIN
I2
; /*
*/
PIN
I3
; /*
*/
12
Z0
; /*
*/
PIN
13
Z1
; /*
*/
PIN
14
Z2
; /*
*/
PIN
15
Z3
; /*
*/
FIELD INPUT=[I3..I0];
FIELD OUTPUT= [Z3..0] ;
TABLE INPUT=>OUTPUT {
'b'0000=>'b'0000;
'b'0001=>'b'0001;
'b'0010=>'b'0011;
'b'0011=>'b'0010;
'b'0100=>'b'0110;
'b'0101=>'b'0111;
'b'0110=>'b'0101;
'b'0111=>'b'0100;
'b'1000=>'b'1100;
'b'1001=>'b'1101;
'b'1010=>'b'1111;
'b'1011=>'b'1110;
'b'1100=>'b'1010;
'b'1101=>'b'1011;
'b'1110=>'b'1001;
'b'1111=>'b'1000;
}
Results
$REPEAT I = [0..7]
$DEFINE S{I} 'b'{I}
$REPEND
SEQUENCE STATES {
PRESENT S0
NEXT S7;
PRESENT S7
NEXT S6;
PRESENT S6
NEXT S5;
PRESENT S5
NEXT S4;
PRESENT S4
NEXT S3;
PRESENT S3
NEXT S2;
PRESENT S2
NEXT S1;
PRESENT S1
NEXT S0;
}
Results
lab2 ;
PartNo
00 ;
Date
17-Feb-13 ;
Revision 01 ;
Designer Engineer ;
Company
Home ;
Assembly None ;
Location
Device
;
g16v8 ;
PIN 1 = CLK;
$repeat i=[0..7]
SEQUENCE STATES {
PRESENT S1
NEXT S2;
PRESENT S2
NEXT S4;
PRESENT S4
NEXT S1;
PRESENT S3
NEXT S1;
PRESENT S5
NEXT S1;
PRESENT S6
NEXT S1;
PRESENT S7
NEXT S1;
PRESENT S0
NEXT S1;
}
Results
Results
present s1
if !x next s1 out !z ;
if x next s2 out z;
present s2
if !x next s2 out z;
if x next s1 out !z;
Results
X is the input and y the output. Output goes to 1 if an odd number of 1 in input is detected. At
vector 4 x=1, hence z=1 until another x=1 is input. At vector 9 x=1 hence even number of 1 thus
output goes to 0.
sequence states {
present s0
if !x next s1 out !z;
if x next s2 out !z;
present s1
Results
X represents the input and z the output. At vector 4 a 010 sequence is detected hence z goes to 1.
At vector 9 and 10 sequence of 11 is detected (overlapping considered) and output goes high.
$repeat i=[0..3]
$define s{i} 'b'{i}
$repend
field input=[y,x];
no=input:0;
ten=input:1;
twen=input:2;
fake=input:3;
sequence states {
present s0
if ten next s1 out !z;
if twen next s2 out !z;
default next s0 out !z;
present s1
if ten next s2 out !z;
if twen next s3 out z;
default next s1 out !z;
present s2
if ten next s3 out z;
if twen next s1 out z;
default next s2 out !z;
present s3
if ten next s1 out !z;
if twen next s2 out !z;
default next s0 out !z;
}
Results
11
PIN
12
Q0
PIN
13
Q1
12
Results
Vector 2 shows state s0 and output is z2 and z3(MG and SR). As long as a car is present on the
side street, the TLC will go through all the states and providing the required output. When there is
no car in the side street (after vector 8) the TLC will remain in state s0.
13
Simulation
The design files were burned and tested accordingly. The appropriate pins were considered as
defined in the design files and they can also be obtained in the .doc file generated by the
WINCUPL.
For example consider the sequence detector:
The pins were defined as follows
pin 1= clk;
pin 2=x;
pin [12..14]=[q2..0];
pin 15 =z;
<=inputs
<= outputs
<= outputs
Vcc
z
q0
q1
q2
All the design files were tested and the results were as expected.
14