DigiLab                                          User's Manual








                            
             A Digital Circuit Simulator for
          IBM Personal Computers & Compatibles
                            
                            
                            
                            
                            
                            
                            
                 Condensed User's Manual
               First Edition : July, 1992
                            







                     M.A.N. Software




















This software product is dedicated to:

                    CAIRO UNIVERSITY
                 FACULTY OF ENGINEERING
        COMMUNICATIONS AND ELECTRONICS DEPARTMENT
                            
and all students whom it may serve to improve their
understanding of digital circuits.


























COPY RIGHT
Copyright 1992 by M.A.N. Software. All rights reserved.

SUPERVISED BY
Dr. Mohsen Rashwan.


PROGRAMMERS
In Alphabitical order,
Amr Abdelmoneim Awadallah,
Magdi Omar Amer,
Nael Fakhry Saleh.


TRADEMARKS ACKNOWLEDGMENTS
  IBM, PC, XT, AT, PS-2/30, CGA, EGA, and VGA, are
  registered trademarks of International Business
  Machines Corporation.
  Microsoft, MS, MS-DOS, and MS-WINDOWS are registered
  trademarks of Microsoft Corporation.
  DigiLab is a trademark of M.A.N. software.


PREFACE

         This  software  package  was  developed   as   a
  graduation project for a B.Sc. degree. It was  selected
  as  a  good basis for emphasizing the powers of  Object
  Oreinted  Programming  (OOP).  It  was  compiled  using
  Borland's  C++  Version  3. The  project  it  self  was
  created  as  a  tool which helps understanding  logical
  design  and its relation to digital circuits.  We  hope
  that  all  users of this programs find  it  simple  and
  straight forward. Enjoy DigiLab.


                                          M.A.N.

Table of contents

CHAPTER ONE:  INTRODUCTION                                 4
FEATURES                                                   4
WHAT DO YOU USE DIGILAB FOR?                               5
SYSTEM REQUIRMENTS                                         8
DIGILAB'S FILES                                            8
MANUAL CONVENTIONS                                         9
ABOUT THIS MANUAL                                         10
IN CASE YOU FIND BUGS                                     10
CHAPTER TWO: GETTING STARTED                              13
HOW TO START DIGILAB?                                     13
ACKNOWLEDGING DIGILAB                                     14
THE USER INTERFACE                                        16
THE MAIN MENU                                             19
SUMMARY                                                   22
CHAPTER 3: EDITING A CIRCUIT                              25
MOVING AROUND                                             25
MODES OF THE PEN                                          27
INTELLIGENT DRAWING PEN                                   28
THE EDIT MENU                                             29
THE ELEMENT MENU                                          32
THE ELEMENTS                                              36
THE RESERVED AREA                                         37
ELEMENT PARAMETERS                                        38
SIMPLE CONNECTION AND BIT-FLOW STRATEGY                   40
DRAWING YOUR FIRST CIRCUIT                                41
RUNNING YOUR FIRST CIRCUIT                                43
CONNECTION ERRORS                                         44
COMMENT ON LARGE CIRCUITS                                 44
SUMMARY                                                   44
CHAPTER 4: RUNNING A CIRCUIT                              47
RUNNING?                                                  47
THE UNIT SIMULATION TIME SLOT                             47
THE DEVELOPMENT CYCLE                                     49
HOW TO RUN A CIRCUIT?                                     50
THE RUN MENU                                              51
REMARKS                                                   54
SUMMARY                                                   55
CHAPTER 5: TIMING DIAGRAMS AND DEBUGGING                  57
WHAT IS A TIMING DIAGRAM                                  57
HOW DOES DIGILAB GENERATE TIMING DIAGRAMS                 58
THE TIMING DIAGRAMS EDITOR                                59
WATCHING TIMING DIAGRAMS                                  61
FETCHING AN ENTRY                                         62
RAMARKS                                                   63
DEBUGGING                                                 63
HAZARDS DETECTION                                         64
SUMMARY                                                   65
CHAPTER 6: MACROS                                         67
WHY USE MACROS?                                           67
HOW TO CREATE A MACRO?                                    69
USING A MACRO                                             70
TIPS WHEN CREATING MACROS                                 71
DIVIDE AND CONQUER                                        73
SUMMARY                                                   73
DIGILAB VERSION 2:                                        74














                          Chapter 1















CHAPTER ONE:   INTRODUCTION

     DigiLab  is  a very easy to use, relatively cheap,  but

still  very  powerfull, Digital Circuit Simulation  software

package.   It   is   recommended   for   students   studying

electronics,  specially those studying digital circuits.  It

has  alot of features that make life easier for the beginner

and professional logic circuit designer. Sarting from simple

draw   and   run  options  to  complicated  timing  diagrams

debugging and creation of new macros1 .

     

     

Features

Some of the major features of DigiLab are:

  An easy to use interactive menu driven User Interface.

  An  easy  to  draw  method, with  an  intelligent  drawing
  mechanism.

  A predefined library of 37 digital elements.

  The  ability  of  the user to create new digital  elements
  known as Macros.

  Combinational,  as  well as Sequential,  logical  circuits
  support.

  FeedBack Simulation and compensation.

  More  than one circuit could drawn and tested on the  same
  board.

  Simple Connection and Bit Flow Strategy.

  Draw and Go option.

  Change parameters of elements while running.

  Step by Step debugging option.

  Create Timing Diagrams.

  Run with or without Timing Diagrams.

  Divide and Conquer Desgin support (Modular Design via  the
  Macro Feater).

  The   capability   to   open   more   than   one   circuit
  simultaneously.

  On-Line  circuit save and load compression to  reduce  the
  size of the ciruit on back storage.

  Detection of trivial circuit errors.


What Do You Use DigiLab For?

     DigiLab  is  a  program  designed  to  efficiently  run

digital  circuit simulations. It is not a drafting  program,

i.e.  you  do  not use it to draw nice circuit diagrams  for

digital  circuits. On the other hand it is a design  program

which  helps you in designing your own digital circuits  and

trying  them  out on the computer first. If you  found  that

your  implementation works well on the  computer,  then  you

could   go   ahead  and  start  realizing  it  as  hardware.

Otherwise,  you  should go on debugging the  logic  of  your

design   on  the  computer,  with  the  powerfull  debugging

features  of our program, until finally your circuit  works.

After  that  you could start realizing the logic circuit  as

hardware.

     

     This  doesn't  only  cut  down the  time  required  for

building  a  logical  circuit, it also   makes  the  testing

process easy and straight forward. Because, if after testing

the  circuit on DigiLab and realizing it as hardware,  if  a

bug  occurred and the hardware circuit didn't work, you will

know  that the error is somewhere in the connections  or  in

one  of  the ICs, but not in the logic. Because you  already

tested  the  logic of the circuit on the computer  and  know

that  it is correct, i.e. DigiLab limits the bugs that could

occurr  during  a  hardware realization to  those  of  wrong

connections  and  faulty ICs. Not just  that,  after  trying

DigiLab you will find that debugging a logical circuit on it

is  much  more easier than debugging the hardware  directly.

This  is  because DigiLab offers you a better  view  of  the

ciruit,  where you are as near as 100% shure of all  of  the

connections,  due  to  its simple connection  and  bit  flow

strategy which will be discussed later.

     

     To  aid the debugging process, DigiLab has the facility

to  observe the Timing Diagrams (wave forms) of any part  in

the circuit. This feature is not only usefull for debugging,

but  also  it simplifies the testing process, where  hazards

can  be  spotted  right  away  on  the  Step-by-Step  timing

diagrams.

     

     For  the professional logical circuit designer we added

the feature of creating Macros. A Macro is  simply a new  IC

which  the  user  of DigiLab could build from  scratch.  You

could simply draw a circuit and assign to it input pins  and

output pins, then ask DigiLab to learn this circuit as a new

predefined  IC  (or macro) and add it to the library.  Since

usually large digital circuit projects are designed  by  the

Divide  and Conquer technique, they are broke into  modules,

therefore you could convert these modules in to macros,  and

finally  collect them all in a single circuit  just  as  you

have drawn them on paper.

     

     Concluding, we may say that DigiLab is one of the  best

and  cheapest digital circuit simulators at the  time,  that

support from simple logic circuits to most complicated ones,

to  satisfy  the  needs of professional  and  amatuer  logic

designers,  at a level that both could enjoy and understand.

DigiLab  is  equipped  by debugging  aids  that  reduce  the

logical  design cycle of any medium scale project to  nearly

half the time needed to complete this cycle by realizing the

logic ciruit as hardware directly.

     


System Requirments

The necessary system requirments for using DigiLab are:

  IBM PC, XT, AT, or PS/2 (all models) or compatible.

  EGA,  VGA,  or  MCGA  display card or compatible,  or  any
  other  card that allows the redefinition of the  character
  set1 .

  DOS (Disk Operating System) Version 3.0 or later.

  One 360K or higher diskette drive, or a fixed disk drive.

  At least 512K RAM (available user Memory).

     

DigiLab's Files

There are two main files that come with DigiLab disk:

           LAB.EXE and this is the main program, without  it

     you could never run DigiLab


           THESET.COM  and  this program loads  the  special

     character  set  that DigiLab uses into the  memory,  It

     should be on the same path as LAB.EXE, or add its  path

     to your AUTOEXEC.BAT. LAB.EXE will not run except if it

     finds  this program. Try running THESET.COM  alone  and

     see what effect it has on numbers.


     The  remaining files are examples for you to learn from

how  to  use  DigiLab, and they are grouped  into  two  main

categories:


           *.CRC files, these are example ciruit files.  Try

     having a quick look at all of them. They emphasize lots

     of the main features of DigiLab.


           *.MAC  files, these are example macros  that  you

     could  use  in  your own circuits, or even in  creating

     bigger  macros. Note that *.CRC files and  *.MAC  files

     having  the  same  name are the  same  ciruits  but  in

     circuit and macro forms respectivly.

     

       README.DOC  ,  this  file contains  some  information

       about  the  examples.  It  also  contains  additional

       information not contained in the manual.

     

     

Manual Conventions

           Letters shown within the "less than" and "greater

than" signs stand for a key on the computer's keyboard.  For

Example, <Enter> would mean the carriage return "ENTER"  key

on  the keyboard, <F2> would mean the F2 function key on the

keyboard.



About This Manual

     This  manual contains all necessary information to  run

DigiLab.   Please  in  case  that  any  of   the   contained

information  are not obvious or obscure, do not hesitate  to

send to one of the addresses listed in the next section, and

we will be glad to send you back immediate help.



In Case You Find Bugs

     We  have tested DigiLab more than once, and it appeared

to  be bug free. But we can't imagine the ways in which  you

could use DigiLab, and as we all know, there is no 100% bug-

free  program  and  bugs  always exist.  So  please  in  the

unlikely ocasion of discovering a bug in DigiLab, could  you

kindly  report it with a full discription back to us in  one

of the following addresses:

     

     Name      :    Amr Abdelmoneim Aly Aly Awadallah.

     Address   :    Cairo University Professors City,

                    Block 24, Flat 7,

                    Bolak Eldakrour,

                    Giza,

                    Egypt.

                    E-Mail: "AMR@FRCU.EUN.EG" or "A.AWADALLAH@IEEE.ORG"

     Name :    Magdi Omar Amer.

     Address   :    1 Said Zou El Fakkar,

                              El Manial,

                              Cairo,

                              Egypt.

     

     Name :    Nael Fakhry Saleh.

     Address   : "NAEL@CAIRO.EUN.EG"















                          Chapter 2















CHAPTER TWO: GETTING STARTED
     

How To Start DigiLab?
     

     DigiLab  could be started from a floppy disk  drive  or

from a fixed disk drive as follows:

     

           For  floppy  disk drive users:  insert  the  disk

     containing DigiLab into one of the system's floppy disk

     drives, then at the DOS prompt type the following:

     

               A:>LAB

               then hit the ENTER key,

     

           For fixed disk drive users: create a subdirectory

     on  your  hard disk, then insert the DigiLab disk  into

     one of the system floppy disk drives and copy all files

     to  the fixed disk drive. The following procedure could

     be applied:

               C:\>MD C:\DIGILAB

               C:\>CD C:\DIGILAB

               C:\DIGILAB> COPY A:*.*

          then enter at the DOS prompt

               C:\DIGILAB>LAB

          then hit enter.

     If   DigiLab  doesn't  startup,  check  that  the  file

THESET.COM  is  with LAB.EXE on the same  directory,  or  at

least  add the path of THESET.COM to your AUTOEXEC.BAT.  You

should also check up that you have the correct display  card

and  enough memory requirments as specified in the  previous

chapter.

     

Acknowledging DigiLab

     As soon as DigiLab start, you will see its Front Screen

with the Main Menu on it, as shown in (fig. 1).

                              
                          (fig. 1)

                              

           As  you can see the screen is divided into  three

main parts, and these are:

     (1)  The  Control Panel, this is the rectangle  on  the

     left of the screen. It is used to inform the user about

     DigiLab's status. The Control Panel is in turn  divided

     into  three  main parts. The first part is the  Control

     Panel's   Hot-Key  Reference  Area,  which  shows   the

     currently active menu, so that the user could easly see

     the  Hot-Keys1.  The second part is the Circuit  Status

     Area  and shows information about the currently  Active

     Circuit1  ,  that  is, its number, its  name1  and  its

     current status which will be discussed in detail later.

     The  third part is the Pen Status Area, which shows the

     current  position and state of the drawing  pen  within

     the currently Active Circuit.

     

     (2)  The Fast Help line, this line gives the user  fast

     help  on  the action which he is going to select.  Also

     when within a circuit it directs the user to which keys

     he  should use keys to move around. When ever  you  are

     stuck some where and don't know what to do, take a fast

     look at the Fast Help line.

     

     (3)  The Work Area, this is the area in which most work

     is  done.  In it you will get the Editor window,  which

     you  use to edit and draw the circuit. You also get the

     Run  Window, Timing Window and important messages  from

     DigiLab  to you. All of these windows will be discussed

     in detail later.

     

     

The User Interface

     DigiLab's  User  Interface is a Menu Driven  Interface.

Its  use is simple and straight forward. You could select  a

certain item by one of two methods:

     

     The  first method is to use the <UP> and <DOWN>  cursor

keys until you reach the required item, then select this  it

by pressing <Enter>. You will notice while you are moving on

the  items  with the highlighted cursor that the  Fast  Help

line gives you immediate help about the selected action,  so

that you can be shure what you are selecting.

     

     The  second  method  is to use the  Hot-Keys.  This  is

simpler  and  faster  than using the  cursor  keys.  But  it

requires that you memorize the Hot-Keys. In fact, at  first,

you  will  need  to  look  at the  Control  Panel's  Hot-Key

Reference Area, or the Menu it self, to learn which  key  to

press to select a certain item. (you will see that the  Hot-

Key  has a different color as for 'O' in "Open" in the  Main

Menu. Refer to (fig. 1) )

     

     Some  Menu items may generate sub-menus that  may  have

more  sub-menus.  To  move in this menu structure,  you  get

deeper  by pressing <Enter> and get shallower (go  back)  by

pressing  <Esc>. You will note that the high-lighted  cursor

keeps  its  position within a certain menu  since  the  last

access.  Also, as you get deeper in the menus,  all  of  the

previous  menus remain appearing on the screen so  that  you

can  know  exactly where you are, this can be seen in  (fig.

2).

     

                              
                          (fig. 2)

     

     Sometimes  DigiLab will need to get certain user  input

from  you, this will be done through what we call  the  User

Input  Window. The User Input Window is a small window  that

usually  appears  in the middle of the screen.  DigiLab  use

this window mainly to get from you the name of a Circuit,  a

Macro,  or an Input/Output pin. For example, (fig. 3)  shows

you  a User Input Window to get the name of a Macro from the

user.

                              
                          (fig. 3)

     

     

     There are some editing keys that you can use within  an

Input  Window  to  edit and manipulate the  string  you  are

entering and these are:

     

     <LEFT>, <RIGHT> cursor keys : use these to travel  left

     and right within the text which you are editing. If you

     hold down the <Ctrl> key while you are using the cursor

     keys you will get fast word movement.

     

     <Home>  :  moves the cursor immediatly to the start  of

     the string.

     

     <End>      : moves the cursor immediatly to the end  of

     the string.

     

     <Delete>  : deletes the character under the cursor, and

     pulls the remaining string.

     

     <Backspace> : deletes the character to the left of  the

     cursor, and pulls the remaining string.

     

     <Esc>     : abandons the input operation.

     

     <Enter>   : accepts the input operation.

     

     

The Main Menu

     The  Main  Menu is the menu which you get on the  Front

Screen.  The  Main  Menu  give  you  access  to  supervisory

actions, like Managing Files. We are going to introduce  you

now to the actions which you can do from the Main Menu.

     

       Open  : This action lets you open an already existing

     circuit.  When you select it a User Input  Window  will

     appear requesting from you the name of the ciruit.  You

     will  notice  that  DigiLab uses the default  extension

     (*.CRC)  for circuits. But ofcourse you could use  your

     own extension. If you enter a circuit name that doesn't

     exist  DigiLab will open a new circuit with that  name,

     ofcourse  it will empty. After you successfully  finish

     this operation you will go back to the Main Menu, where

     you  will see that the name, number, and status of  the

     circuit  is  written in the Circuit Status Area  within

     the Control Panel. Now you could select "Edit" to start

     editing the circuit. (Hot-Key = 'O' )

     

       New  :  select  "New"  if you  want  to  open  a  new

       circuit.  DigiLab  automatically assigns  to  it  the

       name  NONAME.CRC.  When saving a  NONAME.CRC  circuit

       for  the first time, you should save it from the Main

       Menu's  "Save  As"  option and not  from  within  the

       circuit  by  pressing <F2>1 , so that you can  assign

       to  it  a new name. But if you have opened NONAME.CRC

       just  to do some draft work, then you can save it  as

       it  is, or even completely discard it. (Hot-Key = 'N'

       )

     

      Edit  : This is not a single action, it is a group  of

       actions.  Upon  selection of this  option,  the  Edit

       Window  will appear, and DigiLab is ready  to  accept

       your  circuit.  "Edit"  will  be  discussed  in  full

       details in the next chapter. (Hot-Key = 'E' )

     

       Next  :  As  we mentioned before in the  features  of

       DigiLab,  DigiLab  could open more than  one  circuit

       simulataneously,  with  the  number  of  the   Active

       ciruit  shown in the Current Circuit Status Area.  To

       toggle between which of the opended circuits are  the

     Active  Circuit use the "Next" action. (Hot-Key  =  'x'

       )

     

       Save  As : This allows you to save your circuit to  a

       floppy disk drive or to a fixed disk drive. When  you

       select  this option, a User Input Window will  appear

       prompting  you  for the new name of the  circuit.  By

       default  the current name of the Active Circuit  will

       be  within the User Input Window, so if you  want  to

       save  it  you  just hit <Enter>. But if you  want  to

       save  it  with  a  new name you have  to  delete  the

       current name and enter the new name. (Hot-Key  =  'S'

       )

     

       Save Macro : This option saves the Active Circuit  as

       a  Macro.  The  procedures for  saving  a  Macro  are

       similar  to  those  of the "Save As"  action.  Macros

       will  be  discussed in details later  in  chapter  6.

       (Hot-Key = 'M' )

     

       Close  : closes the Active Circuit. Note that "Close"

       doesn't  know if you have saved the circuit  or  not,

       therefore  you have to be sure to save  your  circuit

       before closing it to avoid losing the last couple  of

       changes. If all circuits are closed and there are  no

       active  circuits  in the memory the circuit  name  in

       the  Circuit Status Area will switch to "No  Circuit"

       to  indicate that there is no circuit in the  memory.

       In  this  case  the "Edit", "Save As", "Save  Macro",

       and  "Next" actions will be disabeled, because  there

       is  no  circuits in the memory for them to act  upon.

       (Hot-Key = 'C' )

     

       Quit  : closes DigiLab and returns to DOS. Note  that

       you  also  have to save all ciruits in memory  before

       selecting  "Quit" to avoid losing any changes.  (Hot-

       Key = 'Q' )

     

     

Summary

          In this chapter we got acquainted with DigiLab. We

learned how to install it on a hard disk, we learned how  to

start  it  from  a floppy disk or a hard disk.  We  examined

DigiLab's  Front  Screen  and its three  main  regions.   We

learned  how  to  edit an input string  in  the  User  Input

Window.  We  also  saw how to use the Menu  System  and  the

User's Interface. We learned about the various items of  the

Main  Menu, "Open", "New", "Edit", "Next", "Save As",  "Save

Macro",  "Close", and "Quit". In the next  chapter  we  will

discuss in detail how to "Edit" a circuit.













                          Chapter 3















CHAPTER 3: EDITING A CIRCUIT


     In  this  chapter we will learn how to build a circuit,

and  how  to  draw  in the Edit Window. To  edit  a  certain

circuit you have to be shure first that its name and  number

are  in  the Circuit Status Area, i.e. you have to  be  sure

that  it is the Active Circuit, after that you select "Edit"

from  the  Main  Menu. This opens the Edit Window  and  your

circuit will appear in it. If this is a new circuit the Edit

Window will be empty with nothing in it.

     

     

Moving Around

     Lets  try to open the example PROJECT.CRC, move  in  it

and watch it from the edit window. First start DigiLab, then

select  "Open", then enter the name PROJECT.CRC in the  User

Input Window. After the circuit loads successfuly (which may

take  sometime to decompress the file containing the circuit

information) the name of the circuit PROJECT.CRC will appear

in  the  Circuit Status Area. Select "Edit"  from  the  Main

Menu, and the Edit Window will appear with the circuit in it

as shown in (fig. 4).

                              
                          (fig. 4)

     

     You  will see the small red cursor in the Edit  Window,

we  call this the Pen. You could use the cursor keys to move

the  Pen around. For Fast movement you should hold down  the

<Ctrl> key and, while holding it down, use the cursor  keys.

Take a look at PROJECT.CRC and try to get your self familiar

with moving around in a circuit.

     

     You will notice that the actual size of the circuit  is

bigger than the Edit Window, so actually what you are seeing

in  the  Edit Window is only a part of the circuit. To  know

which part of the circuit you are seeing in the Edit Window,

you have to look at the Scroll Bars present to the left side

of  the Edit Window and at the bottom of the Edit Window  as

can  be seen in (fig. 4). The size of the actual circuit  is

about  (X=400,Y=80)  where  X represents  the  width  and  Y

represents the height. The exact position of the Pen  inside

the  Edit Window could be seen in the Pen Status Area within

the  Control Panel. This position is given as X  and  Y  co-

ordinates  where  (X=1,Y=1) is  the  left  top  corner,  and

(X=400,Y=80) is the lower right corner.



Modes Of The Pen

     The Pen has three Basic Modes:

     

      UP  : This means that the Pen is inactive, i.e. it  is

      not  touching the paper, hence you should select  this

      mode  if  you  desire  it  move  around  watching  the

      circuit without drawing.

     

      Down  : This means that the Pen is active, i.e. it  is

       touching the paper. If you move the Pen while  it  is

       n  this mode you will find that it will leave a drawn

       line  behind it. You use this mode when you  want  to

       connect lines between circuit elements.

     

      Erase  :  This  means that the Pen has  turned  to  an

       eraser,  i.e.  if  it moves over any  lines  it  will

       erase (delete) this lines.

     

     The  state  and  position of the Pen  could  always  be

checked  up in the Pen Status Area. To change the  state  of

the  pen  while you are in the Edit Window, you could  press

one  of  the  Hot-Keys  which can be seen  in  the  Hot-Keys

Reference  Area  in  the Control Panel. Where  pressing  'U'

turns the state of the Pen to Up, 'D' turns the state of the

Pen  to  Down, and 'E' turns the state of the Pen to  Erase.

You  could also change the state of the Pen, by calling  the

Edit  Menu by pressing <F1> then select Up, Down, or  Erase.

Ofcourse  it  is better to remeber the Hot-Keys because  you

usually  need to change the mode of the Pen frequently  when

editing a circuit, and it is quite boring to constantly call

the  Edit Menu then select the required state, while on  the

other hand you could do that at the press of a key.

     

     

Intelligent Drawing Pen
     

      You will notice when you are drawing with the Pen that

it is intelligent and responds to you properly. For example,

while  you  are  drawing  if you  cross  lines  a  jump-over

junction  will be placed, if you want to turn this jump-over

junction  to a 4-way junction you have to place  the  cursor

over  it  and  press <TAB>. On the other hand,  if  you  are

erasing lines you will find that the eraser erases only  the

lines  in  your directions and the lines crossing under  the

lines  you are erasing are left without being erased, except

if you move intentionaly in their direction.

     

     We  did as much work as we can to improve the speed and

efficiency of the drawing process, because we know that this

is  what  take  most  time when testing  a  new  circuit  on

DigiLab.  You  will find that the Pen is as  intelligent  as

possible  to  reduce  the work that YOU should  do.  Another

intelligent drawing feature is the "Zap Line" feature  which

will be discussed in the next section.

     

     

The Edit Menu

     The  hot-keys of the Edit Window could be seen  at  the

Hot-Keys Reference Area in the Control Panel. This shows you

short-cut  hot-keys which you can press to select a  certain

action  at the press of a key. You could select any  of  the

asctions with the hot-keys (which is prefared), or you could

press  <F1>  for  the Edit Menu to appear, where  you  could

select  any action from the Edit Menu by using the <UP>  and

<DOWN> keys and the <Enter> key.

     

     The Edit Menu contains a number of items which are very

imporatant for elementary circuit editing. The items of Edit

Menu are as follows:

     

       Pen Down : used to change the Pen state to down,  and

     correspondly Enable the drawing Pen. (Hot-Key = 'D' )

     

       Pen  Up  :  used to change the Pen state to  up,  and

       correspondly disable the drawing Pen. (Hot-Key =  'U'

       )

     

       Erase  :  used to change the Pen state to Erase,  and

       correspondly Enable the Eraser. (Hot-Key = 'E' )

     

       Zap  Line  :  this  is  one of DigiLab's  intelligent

       drawing   features.  It  could  trace  and  erase   a

       complete  connection  without affecting  other  lines

       that  may be passing under this connection.  Thus  if

       you  want  to  delete  a  certain  line,  instead  of

       enabling the eraser and erasing this line segment  by

       segment  you can ask DigiLab to do the work for  you.

       You  can stand on any part of the line to be deleted,

       with  the  Pen  in  the UP mode, then  press  'Z'  or

       select  "Zap  Line" form the Edit  Menu,  after  that

       DigiLab  will start to trace this line and delete  it

       for you. (Hot-Key = 'Z' )

     

       Element  :  You  select this when you  want  to  Add,

       Move,  Remove or Change the parameters of one of  the

       logical  elements within your logical  circuit.  i.e.

       this  is  your path to element editing functions  and

       will  be  discussed in more detail in  the  following

       section. (Hot-Key = 'L' )

     

       Timing  :  This  item gives you acces to  the  Timing

       Diagrams  Editing Panel, which will  be  dicussed  in

       more detail in chapter 5. (Hot-Key = 'T' )

     

       Run  :  This  starts running the circuit  simulation,

       and  will  be discussed in the next chapter. (Hot-Key

       = 'R' )

     

       Window  :  Selecting  this gives  you  acces  to  the

       window "Move" and "Resize" features. This allows  you

       to  resize  and  move the Edit Window by  the  cursor

       keys as shown in (fig. 5).

                              
                          (fig. 5)

     

     

The Element Menu

     The  Element  Menu gives you acces to a library  of  37

predefined  logical design elements. It also  lets  you  add

Macros  to  the circuit, (Macros are elements that  you  can

design  and  add to the predefined library of  elements,  we

have  supplied  a  couple of Macros  with  this  version  of

DigiLab,  future  versions  will  have  more  Macros.).  The

Element  Menu  has  some  options that  let  you  manipulate

elements,  like Moving an element or Removing it  completely

from the circuit. You could also change the parameters of an

element. For most elements the parameters will be its delay,

other  elements may have more than one parameter to  change.

Thus to fine tune the parameters of all the elements in  the

circuit to satisfy your realization requirments you have  to

use the change parameters action.

     

     To  activate the Element Menu, you can call it directly

from  the Edit Window by pressing 'L' or you can press  <F1>

then  select "Element" from the Edit Menu1 . In  both  cases

the Edit Menu will appear, and it has the following items:

     

       Add Element : This opens a set of hierarchical menus,

     that  allows  you  to easly select the logical  circuit

     element  which  you  want to add to your  circuit.  For

     example,  in  (fig.  6) we see how to  select  a  "Data

     Selector".

                              
                          (fig. 6)

     

           First we press 'L' to get the Element Menu,  then

     'A' for "Add Element", then 'C' for Combinational Logic

     Circuit  Elements, then finally we press  'S'  for  the

     Data  Selector. We should remind you here that the same

     procedure could be done by the cursor keys and <Enter>.

     One  special case is the addition of a Macro.  In  this

     case  DigiLab  will prompt for you, with a  User  Input

     Window,  to ask you the name of the Macro to  add,  see

     (fig. 7). (Hot-Key = 'A' )

     

                              
                          (fig. 7)

     

       Move  :  If  you  want to move an  element  from  its

       position,  you  put the Pen over  any  part  of  that

       element,  then  select "Move" from the Element  Menu.

       The  background of the element will change indicating

       that  you  can  move it, see (fig. 8).  To  drop  the

       element in a new position hit <Enter>, other wise  to

       abandon the operation press <Esc>. (Hot-Key = 'M' )

                              
                          (fig. 8)

     

       Remove  :  If you want to delete (remove) an  element

       from  the  circuit, put the Pen on any  part  of  the

       element, then select "Remove" from the Element  Menu.

       (Hot-Key = 'R' )

     

        Parameters :  If you want to change the parametrs of

     any  element,  put the Pen on any part of the  element,

     then select "Parameters" from the Element Menu. A short

     cut  for  doing this is to put the Pen on  the  element

     then hit the <TAB> key. (Hot-Key = 'P', Short-Cut-Key =

     <TAB> )

     

     

The Elements

     There  are alot of predefined elements. They are mainly

divided into 5 groups:

     

     (1)  Gates  :  This group contains all  the  elementary

     logical  gates,  like  AND, OR, XOR,  NOR,  NAND,  NOT,

     BUFFER.  Most of these gates are present in forms  that

     can take more than one input.

  
     (2)   I/O  :  This  group  contains  Input  and  Output

     elements.  For  example : Switch,  Clock,  Probe,  LED,

     Hexadecimal-KeyBoard,  Hexadecimal-Display,   Input-Pin

     and Output-Pin.

     

     (3)  Sequential Elements : This group contains elements

     that are related to sequential circuits. They are : RS-

     FlipFlop, JK-FlipFlop, T-FlipFlop, D-FlipFlop, Counter-

     4, and Shift-Register-4.

     

     (4)   Combinational  Elements:  This   group   contains

     elements  that  are related to combinational  circuits.

     They  are  :  Adder-4,  Comparator-4,  MUX-8,  DEMUX-8,

     Encoder-8, Decoder-8, and Data Selector.

     

     (5) Macros : This is the user defined logical elements.

     Macros will be discussed in detail in chapter 6.

     

     When  an element is choosen the Pen takes the shape  of

that element. When you press <Enter> an image of the element

is  dropped  on the circuit, but you still have the  element

and  can  make more images of it. When you finish  using  an

element, you could get the Pen back by pressing <Esc>.


     

     You  will  notice that for combinational and sequential

elements   the  order  of  the  bits  are  with  the   Least

Significant Bit at the top and the Most Significant  Bit  at

the Bottom, as shown in the figure.

     

     

The Reserved Area

     We  must note that all elements reserve a certain  area

around  them on the screen. So you must pay great  attention

to  your  layout of the circuit. If you want to  draw  lines

between  elements  you must be shure to leave  an  additonal

space  for the area which each element reserve. When  adding

or   removing  an  element  the  backgroung  color   changes

indicating  the area which it reserves, refer to  (fig.  8).

You should also note that elements can't overlap in the area

they  reserve,  so if you try to do this the  element  won't

drop on to the circuit. Also, you can not draw lines in  the

reserved area.

     

     

Element Parameters

           Every element has its unique parameters. You  can

adjust the prarameters of all the elements in the circuit by

using  the  <TAB> key on the desired element.  All  elements

have  a Delay1 . The UNIT Delay equals the Simulation Timing

Slice  which  DigiLab uses when simulating and  running  the

circuit. Therefore you should, at least, se the time of this

Unit  Delay  to that of the Delay of the fastest Element  in

your  design.  Other  Elememts could be assigned  delays  as

multiples of this Unit Delay. As an example of changing  the

delay of an Adder refer to (fig. 9).

                              
                          (fig. 9)

     The  delay  could  be changed by using  the  <LEFT>  or

<RIGHT>  cursor keys to change it in units. For fast  change

of  the delay press the <Ctrl> key, and hold it down,  while

you are using the cursor keys.

     

     Special  elements  may  have more  paramters  than  the

delay,  like  the  Clock and Counter.  Others  may  have  no

parameters  at  all,  like the LED, Probe  and  Hexadecimal-

Display. Others may change directly on the screen, like  the

Switch  which toggles between 'Logic One Level'  and  'Logic

Zero  Level' at the application of the <TAB> key on it,  and

the  Hexadecimal-Keyboard which changes to the new key under

the  Pen when the <TAB> key is pressed. For the Hexadecimal-

Keyboard you press a key by pressing the <TAB> on it.

     


     One final use of the <TAB> key is to toggle the type of

a junction from a jump-over1 junciotn to a 4-way connection.

This  could  be  done  by  puting the  Pen  on  the  desired

connection and pressing the <TAB> key.

     


Simple Connection And Bit-Flow Strategy


     The  connection of elements by wires in DigiLab  is  as

simple  as connecting them on a bread board, if not simpler.

     The  elements  are drawn in a form which  simplify  the

connections  and  unify  the bit flow  direction.  You  will

notice  that most elements are oriented such that  the  main

flow of data is from the left to the right. This is done for

two  main reasons. Firstly to standarize the shape and  size

of  most elements. Secondly, to clarify your imagination  of

the  flow in the circuit, where most logical design  layouts

when  done  as module sketches on paper, are done  with  the

data  flow  in one direction. So we may conclude  that  this

Simple Connection and Bit-Flow Strategy makes it easier  for

you to realize your circuit on DigiLab.



Drawing your First Circuit

     Now  it  is  time  for you to draw your first  circuit.

First close PROJECT.CRC if you sill have it open. This could

be  done as follows: First close the Edit Window by pressing

<Esc>  this takes you back to the Main Menu. Then you  could

either close PROJECT.CRC and create a new circuit, or create

a  new  circuit  while PROJECT.CRC is still in  the  memory.

Suppose you choosed the latter, and selected "New" from  the

Main   Menu  while  PROJECT.CRC  is  still  in  the  memory,

PROJECT.CRC will be given the number 2, and the new  circuit

which haves the name NONAME.CRC will be number 1. NONAME.CRC

will  be  considered by DigiLab as being the Active Circuit.

You  could  switch  between the two  circuits  by  selecting

"Next" from the Main Menu.

     

     To  start  editing your new circuit, you must be  shure

that  it is the currently Active Circuit, i.e. its name  and

number is in the Circuit Status Area. Then after that select

"Edit" from the Main Menu to edit.

     

     As  a  fixed procedure whenever you come to  realize  a

circuit you have to draw its layout on paper first, and  try

to  make the elements look similar to those of DigiLab, with

the  main flow of data from the left to the right. Then  you

start  by placing all elements in their places first  taking

care to leave enough distances between them to allow for the

Reserved Area. While doing this you may need to observe  the

(X,Y)  co-ordinates at the Pen Status Area. If you  place  a

wrong  element you could remove it, if you place an  element

in  a  wrong  place you could move it to a new place.  After

placing most of the elements in their places you could start

joining  the  lines between them. In case some elements  are

too  close to each other, and you can not draw lines between

them, try moving them apart.

     

                          (fig. 10)

     As  a  srarting  example, start  realizing  the  simple

circuit, shown in (fig. 10), where we have an AND gate  with

two SWITCHES at its inputs and a PROBE at its output.

     

     To  realize this simple circuit, we at start by getting

an  AND-2 and putting it in some empty place on the circuit.

Then  we get a Switch and put it twice at the inputs of  the

AND-2 gate, then we get a Probe and put it at the output  of

the  AND-2 gate. After that we start joining up elements  by

drawing lines with the Pen down. Note that if you enter  the

area  of an element, with the Pen down, no lines are  drawn.

Thus  you could start drawing lines by standing at the ouput

of  one of the switches, move to the corresponding input  in

the  AND-2,  then from within the AND-2 (while  the  Pen  is

still down) go to the other input pin, and from it goto  the

other switch. Now rise the Pen by pushing 'U' then goto  the

output of the AND-2 and press 'D' to enable the Pen. Finally

join  the ouput of the AND-2 gate to the input of the  Probe

and rise the Pen.

     

     

Running Your First Circuit

           Now  it  is  time you run your circuit.  This  is

simply  done by pressing 'R' for "Run", or by pressing  <F1>

to  get  the Edit Menu, then selecting "Run" from it by  the

cursor  keys and <Enter>. If your circuit finishes  analysis

successfully,  it will start to run, and you will  see  that

the circuit status in the Circuit Status Area of the Control

Panel is Running. You see if your AND-2 is working correctly

or not by using the <TAB> key on the Switches to toggle your

values.  Try all possible combinations to see if this  AND-2

gate  is  faulty or not. In the following chapter we discuss

the Run Menu.



Connection Errors

     DigiLab is designed to detect connection errors. So  if

you  mistakingly do a connection error, DigiLab will  detect

it  during  its, Analysis phase and report it back  to  you.

When you go back to the circuit you will find the cursor  in

the place where the error ocurred. The only FATAL error that

you  can do, is to connect the output of one of the elements

to the output of another element, which is obviously unvalid

becuase ouputs can only be connected to inputs.

     

     

Comment On Large Circuits

     Large  circuits must be designed on paper first.  After

that  you should organize it in a manner suitable for  entry

to  DigiLab. Where you must take care to keep the main  data

flow  from the left to the right (except for feed-back where

the  flow  becomes from right to left). If the circuit  gets

large  enough to fit into one Edit Circuit, then you  should

think  about  dividing  it into modules  and  converting  to

Macros  then  join up all of these Macros  together  in  One

Circuit.



Summary

     In  this  chapter  you learned how to build  a  circuit

using  DigiLab's circuit Editor Window. You learned  how  to

use  the  Pen and the Edit Menu. You learned how to  Draw  a

circuit  and  How to Run a circuit. In the next  chapter  we

discuss in more detail how to run a circuit.













                          Chapter 4















CHAPTER 4: RUNNING A CIRCUIT

     By now we assume that the reader can use DigiLab's user

interface easly. So we won't discuss the operation steps  in

detail  as  in the previous chapters. On the other  hand  we

will  concentrate  on  the  main features  of  running  your

circuits on DigiLab.

     

     In  the  previous  chapter we learned  how  to  draw  a

circuit  using DigiLab's circuit editor. Now it is  time  to

learn  how could we get the circuit running. To do  this  we

have to explain to you what do we mean by running.

     

Running?

     Running a circuit means asking DigiLab to simulate  the

circuit  operations as if it was a real hard-wired  circuit.

That  is,  DigiLab  allows you to move on  the  circuit  and

toggle  switches  or  change inputs from  the  Hex-keyboard,

while  the circuit is actually running. Doing this you  will

feel  as  the  simulated circuit is exactly as a  hard-wired

one. This is the main point of using DigiLab. This is why we

built  DigiLab at the first place. We wanted DigiLab  to  be

able  make you feel as if the simulated circuit is  actually

materializing infront of you.

     

The Unit Simulation Time Slot
     

     We  talked previously on the Unit Simulation Time Slot,

and that it should be equal to the delay of the element with

the  smallest  delay  in  your hard-wired  circuit.  DigiLab

simulates   your  circuit  depending  on  this  USTS   (Unit

Simulation  Time  Slot), the speed of  the  simulation  with

respect  to absolute time obviously depends on the speed  pf

DigiLab and consequently on the speed of your computer, i.e.

the  faster  your computer the faster the simulated  circuit

will run.

     

     Ofcourse  the  speed  of the elements  are  fixed  with

respect to each other, and hence the speed of simulation  of

the  circuit is fixed, (but not equal to), with  respect  to

absolute  time. This is known as time scaling  and  is  used

frequently  in  simulation packages so that the  user  could

adjust the speed of the simulation, to the degree that makes

changes  obvious to him, so that he can observe the  circuit

accuratly,  measure its performance, ensure  its  efficiency

and facilitate the debugging it self.

     

     DigiLab  allows you to change the speed of  simulation,

the  fastest  speed  depends greatly on the  speed  of  your

computer  system. We recommend that during debugging  stages

you  should  reduce the speed of simulation to  observe  the

logic circuit and evaluate its performance. If you find that

every thing is OK, you can run the circuit simulation  at  a

higher  speed.  Later this chapter you  will  learn  how  to

change DigiLab's speed of simulation.

     

The Development Cycle
     

     The method by which DigiLab run a circuit is similar to

that of a compiler. The cycle of building a program with its

three  main  phases (Edit, Compile, and Run) are similar  to

those  of  DigiLab, where you first Edit the  circuit,  then

when  you  ask  DigiLab to run the circuit it  Analyzes  the

circuit  (which  is similar to compiling  a  program)  then,

finally,  DigiLab Runs the circuit. Where upon  running  the

circuit  you  may discover some bugs and have  to  edit  the

circuit again and so on until the circuit work properly.  We

call this the Development Cycle, and in DigiLab we tried  to

make  it as fast as possible to reduce the time required  to

debug the circuit.

     

     The  Analyze  phase,  is  done inherently  by  DigiLab.

During  this phase DigiLab pases along the drawing  of  your

circuit   and  figuresout  the  relation  between  different

elements,  and  links them up together. Analyzing  may  take

sometime,  so  whenever  DigiLab  is  analyzing  a  blinking

message  will appear in the center of the screen  to  inform

you that DigiLab is busy analyzing your circuit.


     


How To Run A Circuit?

     In  the  previous section we discussed  how  to  run  a

simple  circuit  on DigiLab. That was after drawing  DigiLab

you  select Run from the Edit Menu. Then you can move in the

circuit  and  toggle  switches  or  change  values  of  Hex-

Keyboards  by  using the <TAB> key. You could also  use  the

<TAB>  key to change the prarameters of any of the elements,

for  example you could adjust the frequency of  a  clock  by

changing its HI/LO period and fixing its phase. During  this

you  should notice that DigiLab has entered a new mode, that

is the Run Mode, hence we now have a Run Menu instead of the

Edit Window.

     

     When  you  are in the Run Mode, you can move around  in

the  circuit  while it is running, you could  slow  down  or

speed  up the simulation, you could halt the simulation  for

Step-by-Step  debugging,  or you can  hide/show  the  Timing

Diagrams Window. In the next section we will discuss how can

you select these from the Run Menu.

     

The Run Menu

     Once  you select Run from the Edit Menu and the circuit

switches  to  the  running  mode,  the  Run  Menu  will   be

activated. Now we will discuss each of the items of the  Run

Menu which could be seen in (fig. 11).



                              
                          (fig. 11)

       Pause  :  You  use this item to switch the  state  of

     running  between  Step-by-Step running  and  continious

     running.  By  default DigiLab starts in the  continious

     running  mode,  when you press 'P' it switches  to  the

     Step-By-Step mode. Normaly you do not need the Step-By-

     Step  mode  and work with the continious running  mode,

     but if you need to debug your circuit you will need  to

     run  it  Step-by-Step so that you can spot the position

     of  a  certain  bug. In the Step-by-Step  mode  DigiLab

     advances  the simulation by one USTS per press  on  the

     <SPACE  BAR>,  while  in  the continious  mode  DigiLab

     advances  the  simulation by a prespecified  number  of

     USTS depending on the speed of simulation.

     

      TD only : This option will display the timing diagrams

     window only. The default when you run a circuit  is  to

     display the Circuit Simulation Window only if there  is

     no  Timing Diagrams entries, but if there is  at  least

     one  Timing  Diagram entry both the Circuit  Simulation

     Window  and the Timing Diagrams Window will  be  shown,

     but  by  your  own  wish you could display  the  Timing

     Diagrams  Window  only,  or both  the  Timing  Diagrams

     Window  and  the  Circuit   Simulation  Window.  Timing

     diagrams will be discussed in more detail in chapter 5.

     

       Circuit  only: This option will display  the  Circuit

       Simulation Window Only.

     

       Both: Obviously, this option will display both of the

       Circuit  Simulation  Window and the  Timing  Diagrams

       Window.

     

       Faster:  pressing 'F' or selecting "Faster" from  the

       Run  Menu will increase the number of USTS per second

       and effetively increase the speed of simulation.

     

       Slower:  pressing 'S' or selecting "Slower" from  the

       Run  Menu will decrease the number of USTS per second

       and effetively reduce the speed of simulation.

     

       Resize  Up:  pressing  'U' or selecting  "Resize  Up"

       from  the Run Menu will change the level of the  line

       separating  the  Circuit Simulation Window  from  the

       Timing  Diagrams Window upwardly. That is reduce  the

       size  of  the Circuit Simulation Window with  respect

       to the Timing Diagrams Window.

     

       Resize Down: pressing 'D' or selecting "Resize  Down"

       from  the Run Menu will change the level of the  line

       separating  the  Circuit Simulation Window  from  the

       Timing  Diagrams Window downwardly. That is  increase

       the  size  of  the  Circuit  Simulation  Window  with

       respect to the Timing Diagrams Window.

     

     It is worthwhile to remind you here to take a fast look

on the Fast Help Line whenever you get stuck and do not know

what to do.

     

     Finally,  to  exit from the Run Mode back to  the  Edit

Mode hit <Esc>.

     

     

Remarks

     When  planning the layout of a circuit in the Edit Mode

try  to keep all of the important inputs and outputs of  the

circuit  in  the  same  area, this facilitate  the  task  of

changing the inputs of the circuit and observing the  output

simultaneously.  Other wise if you do not put  them  in  the

same  area  you will keep on going back and fro between  the

switches  which you change and the displays which  show  you

the  output.  To  understand the meaning of this  commentary

consider  having a look at PROJECT.CRC, you will  find  that

all  of the important inputs and outputs of the circuit  lie

in  an  area  which  could appear in the Circuit  Simulation

Window in one time.

     

     

Summary

     In this chapter we learned how to run a circuit, how to

change the speed of simulation and how to select between the

Circuit Simulation Window and The Timing Diagrams Window. We

also  got acquainted with the Run Menu and learned  all  the

options that it could offer. In the following chapter we are

going to learn about Timing Diagrams.













                          Chapter 5















CHAPTER 5: TIMING DIAGRAMS AND DEBUGGING
     

     The  reader  who completed the previous  chapters  have

enough  knowledge to run DigiLab efficiently as  an  amatuer

logic  circuit  designer.  In  this  chapter  and  following

chapter we will learn some aspects of DigiLab that serve the

professional  programmers. In this  chapter  we  will  learn

about Timing Diagrams and Debugging. In the next chapter  we

will discus Macros in full detail.

     

     

What Is A Timing Diagram

     A  timing diagram is the logical wave form of the ouput

of  one  of  the  elements in the circuit, i.e.  the  timing

diagram  is  a  plot of the variation of the  value  of  the

output of one of the elements in the circuit with respect to

time. Since this value could be either "Logic One Level"  or

"Logic  Zero  Level", therefore the timing diagram  haves  a

rectangular waveform nature1 . Typical timing diagrams  from

PROJECT.CRC could be observed in (fig. 12).

                              
                          (fig. 12)

     

     

How Does DigiLab Generate Timing Diagrams

     Ofcourse  DigiLab doen't generate Timing  Diagrams  for

     all  the elements in the current but only for those you

DigiLab  to  draw. Hence DigiLab has what we call  a  Timing

Diagrams  Editor  by which you could add  or  remove  timing

diagram  entries  to the Timing Diagram List  which  DigiLab

scans  periodically while running to display the entries  in

it on the Timing Diagrams Display.

     

     What  actually happens inside DigiLab is that it  scans

the  Timing Diagrams List every USTS, and while scanning it,

it  updates the Timing Diagrams Display. The scaling of  the

Timing  Diagrams Display is relative to the USTS, where  the

smallest  unit on the Timing Diagrams Display  is  the  USTS

itself. Hence the speed of flow of timing diagrams depend on

the  number  of USTS which DigiLab process per  second,  and

consequently  on  the speed of simulation  which  you  could

control by pressing 'F' for "Faster" and 'S' for "Slower".

     

     

The Timing Diagrams Editor

     The  Timing  Diagram Editor is used to  add  or  delete

entries from the Timing Diagram List which DigiLab scans and

displays in the Timing Diagram Display Window. You can  call

the Timing Diagram Editor from the Edit Menu.

     

     Once  the Timing Diagram Editor is invoked, the  Timing

Diagram Editor Window will appear, this windows displays  to

you  the  list of Timing Diagrams which DigiLab will display

in  the Timing Diagram Diplay Window if a run is called.  If

Timing  Diagrams exist in the Timing Diagram List they  will

appear  in  the  Timing Diagram Editor Window  and  you  can

scroll  through them by pressing the <+> or <-> keys on  the

right  side  of  your keyboard. But if there  is  no  Timing

Diagram  entries in the Timing Diagram List, you  will  find

the Timing Diagram Editor Window Empty.

     

     To  insert  new  Timing Diagrams to the Timing  Diagram

List,  you  have to press the <Insert> key on your keyboard.

Doing this takes you to the Circuit Editor Window where  you

can  move around with the Pen as you did before. As long  as

you  are in the Circuit Editor Window, you are in the Timing

Diagram insert mode. To insert a Timing Diagram you have  to

go to the output and press <Enter> then DigiLab will ask you

for  a name for this Timing Diagram entry. You will have  to

enter this name via the User Input Window as you did before.

You will notice that DigiLab sets a default name similar  to

the  name of the element that you selected to add one of its

outputs to the Timing Diagram List.

     

     To  reduce  the work that you have to do to search  for

the  ouput  of the element connected to a line you  want  to

watch its Timing Diagram, DigiLab has an intelligent feature

of  detecting this output automatically. i.e. DigiLab allows

you  to  put  the  Pen on any line and press  <Enter>,  then

DigiLab  traces this line to find the element  connected  to

it.  Once DigiLab finds this element it display its name  in

the  User Input Window, where you could select this name  or

enter a new one to be added to the Timing Diagram List.

     

     After you have inserted a number of Timing Diagrams  to

the  Timing Diagram List, you can return back to the  Timing

Diagram Editor by pressing the <Esc> key. Once back  in  the

Timing  Diagram  Editor you can delete  any  of  the  Timing

Diagrams by pressing <Delete> while the high-lighted  cursor

is  on  the  Timing Diagram to be deleted. You could  scroll

through  the  Timing  Diagrams by the  <+>/<->  keys  as  we

mentioned before.

     

     When  you  want to leave the Timing Diagram Editor  you

press <Esc>. This will take you back to the Edit Mode, where

you could continue Editing your circuit.

     

     

Watching Timing Diagrams
     

     By  now you should be able to guess how to watch Timing

Diagrams. Every thing is simple with DigiLab. If you are  in

the Edit Mode and Invoke the Run Mode the Circuit Simulation

Display  Window  will appear and DigiLab will  look  up  the

Timing  Diagram  List to see if it has any entries.  If  the

Timing  Diagram  List is empty DigiLab  will  not  show  the

Timing  Diagram  Display Window, and will  run  the  circuit

alone  without Timing Diagrams. But, on the other  hand,  if

their  is  at  least  one entry in the Timing  Diagram  List

DigiLab  will  display both the Circuit  Simulation  Display

Window  and the Timing Diagrams Window. Ofcourse  you  could

select  which to display by selecting "Both", "Timing Only",

or "Circuit Only" from the Run Menu.

     

     You  could  still  move around in the  circuit  by  the

cursor  keys,  you  could  also scroll  through  the  Timing

Diagram  List by the <+>/<-> keys on the right side of  your

keyboard. This could be seen in (fig. 13)

                              
                          (fig. 13)

                              

                              

Fetching An Entry

     If  you press <Enter> while the high-lighted cursor  is

over one of the Timing Diagram entries in the Timing Diagram

Diplay  Window,  DigiLab will transfer  the  cursor  to  the

output related to this Timing Diagram entry. This process is

known  as fetching a timing diagram. Obviously this  feature

is valid only while the circuit is in the Run Mode.

     

     

Ramarks

     Timing  diagrams are very important for monitoring  the

performance of any sequential circuit. DigiLab allows you to

have  up  to  50  Timing Diagram to be added to  the  Timing

Diagram  List.  So  you  must  pay  great  attention   while

selecting which Timing Diagram to add to the Timing  Diagram

List (even though we doubt you will ever need to create more

than 50 Timing Diagrams).

     

     As  well  as running the circuit in Step-By-Step  Mode,

the  Timing  Diagrams could be run in a  Step-By-Step  mode.

This is very useful for debugging.

     

     

Debugging
     

     While building DigiLab we paid great attention to  make

it suitable to the expert as well as amatuer logic designer.

This  meant  that we had to support DigiLab  with  powerfull

debugging features.

     

     The   main   degugging  aids  that  we   expected   the

professional  logic designer will despiaratly need  was  the

Step-By-Step  mode and the Timing Diagrams. Ofcourse  Timing

Diagrams allows you to spot alot of bugs in your design, but

there is no way that it is going to cover all the domain  of

interest,  this  meant that we had to add extra  facilities.

These  extra  facilities came out to be the  Continious  Run

Mode  and  the Step-By-Step Run Mode. While still evaluating

the   performance  of  your  circuit  you  should  use   the

Continious Run Mode, but if debugging the circuit you should

use  the  Step-By-Step Run Mode where you  can  advance  the

Timing Diagram by one USTS per press of the <SPACE BAR>.

     

     The  use  of these debugging strategies is out  of  the

scope  of  this  simple "User's Manual" but  if  you  are  a

professional  logic  designer  you  will  find  that   these

features offer you alot of help in finding the bugs in  your

design.

     

     

Hazards Detection

     DigiLab could not, yet, detect the hazards directly for

you,  but  it  offers you the means of spotting (Dynamic  or

Static) (Function/Logic) hazards directly on the screen.  If

you  step  through your Timing diagrams in the  Step-By-Step

mode you will be able to detect any hazards directly on  the

screen.

     

     

Summary

     In   this  chapter  we  introduced  when  of  the  most

important features of any logic circuit simulator  and  that

is the Timing Diagrams. We learned how to ask DigiLab to add

Timing Diagrams to its Timing Diagram List. We also gave you

hints  of how to debug your circuit and how to discover  any

hazards present in them.

     

     In  the next chapter we are going to discuss on of  the

most  important  features that DigiLab  have,  and  that  is

Macros.













                          Chapter 6















CHAPTER 6: MACROS

     Macros are user defined elements that could be added to

DigiLab's  predefined library. They  are  one  of  the  most

powerfull,  (if  not  the  most  powerfull),  features  that

DigiLab present.

     

Why Use Macros?

     Macros group alot of work that you do in a circuit into

one  single  element. i.e. by Macros you can  add  new  user

defined  elements  (or  better say ICs)  to  the  predefined

library of DigiLab.

     

     As  for programming, Macros are Modular. Therefore they

reduce the amount of work you do because thay can be used in

the  same circuit more than once. For example if you have  a

ceratin  logic function that repeats a number  of  times  in

your  circuit,  why not define this group of  elements  that

perform  this  logics function into one Macro and  use  this

Macro  in place of the group of elements. This foesn't  just

free  area  on  your circuit, but also speeds  up  DigiLab's

processing  of your circuit, because a Macro is pre-analyzed

and  doesn't require analizing, thus the time given  to  the

analyze phase is greatly reduced.

     

     Infact  Macros  are  much  more  like  procedures   for

programming, where a group of elements (instructions)  could

be  grouped into one Macro (procedure) rather than having to

draw this group of elements more than once.

     

     As  an  example  of the Macro we refer to  PROJECT.CRC,

where  we  have  adjusted this porject  as  a  Macro  called

ELEV.MAC  coming from ELEV.CRC. Finally the  Macro  ELEV.MAC

was  used in a new project called PROJMAC.CRC, where in this

circuit the whole PROJECT.CRC circuit have been replaced  by

a  single  element known as ELEV.MAC this could be  seen  in

(fig. 14). Aren't Macros just great !!.

                              
                          (fig. 14)

     

How To Create A Macro?

     The  creation  of  a  Macro is  so  easy  and  straight

forward.  It depends on what we call INPUT-PINs and  OUTPUT-

PINs. These could be reached from the "I/O" menu which comes

from "Add Element" which comes from the "ELement Menu" which

could bre reached directly from the Edit Menu.

     

     Once  you  have  drawn a Macro and decided  which  pins

should  be  INPUT-PINs and which should be  OUTPUT-PINs  you

should  get these Pins and connect them to the circuit  like

any  other element as shown in (fig. 15) where we could  see

four OUTPUT-PINs.

                              
                          (fig. 15)

     

     Once  you finish connecting all INPUT-PINs and  OUTPUT-

PINs  to  the circuit you should start labeling  them,  this

could be done by changing their parameters, i.e. by pressing

the  <TAB> key or by selecting "Parameters" from the Element

Menu.

     

     The  last step now is to ask DigiLab to add this  Macro

to  its library. This is done by asking DigiLab to save  the

current  circuit as a Macro. This option could  be  selected

easly  from  the Main Menu. Upon selection of  "Save  Macro"

from the Main Menu, DigiLab will prompt you for the name  of

the  Macro.  The default extension of the Macro is  "*.MAC",

but this doesn't mean that you can't use your own extension.

As  a good habit it is better for the Macro to have the same

name as its counter part circuit. (for example: ELEV.MAC and

ELEV.CRC).

     

     After  entering  the  name of the Macro,  DigiLab  will

analyze  the  circuit and save it as if it is a new  element

ready for you to use at any time.

     

     

Using A Macro

     Using  a  Macro is as simple as using any other element

in  DigiLab's library. You just have to select "Macro"  from

the  "Add Element" Menu, then DigiLab will ask you  for  the

name  of  the  Macro you want to load, if this  Macro  exist

DigiLab will load it sucessfully and from then on the  Macro

is  like any other element in DigiLab's library except  that

you  can't  change its parameters. If you need to  change  a

parameter in one of the elements of the macro you have to go

to  its *.CRC file, change the parameters then Save as Macro

again.

     

Tips When Creating Macros

     When  creating a macro you must test it fully to ensure

that  it has no bugs. This is not just a good habbit but  it

improves  the  modularity of a macro and ensures  that  when

this  macro is connected in a larger circuit, then if a  bug

occurs  the  error won't be inside the macro but some  where

outside it.

     


     When adding Pins to the Macro you should add them in an

ordered  way.  The Pins you add first to a Macro  appear  as

higher Pins in the new Macro Element. So you should pay alot

of  attention when adding pins to a Macro. For  example,  if

you  want  to get a Macro as that shown in the figure,  then

you  have  to  insert the A0 OUTPUT-PIN first, then  the  A1

OUTPUT-PIN then the A2 OUTPUT-PIN then finally the A3 OUTPUT-

PIN.  You must add them in this order otherwise you may  get

an  unrequired entagled Macro. You should also note that the

bit-flow  direction of the Macro is set  like  that  of  all

other elements to satisfy the Simple Connection and Bit-Flow

Strategy.

     

     While  designing a Macro you should make it as  modular

as  possible  with  all requirments satisied  and  important

inputs and outputs considered as INPUT-PINs and OUTPUT-PINs.

We  should  stress on you again to keep the imporant  inputs

and outputs in a circuit to be converted to a Macro as INPUT-

PINs  and  OUTPUT-PINs.  For example  all  clocks  within  a

circuit  to  be  converted to a Macro should be  changed  to

INPUT-PINs and labeled correctly. This is very important  to

ensure the modularity of a Macro. You will get to learn  how

to  design  a  Macro  by  experience,  but  if  you  are   a

professional  logic designer then we think that  creating  a

Macro is so easy and striaght forward for you to try.

     

     DigiLab  allows you to create Macro in  Macro  with  no

limitation  on  the  depth of nesting. But  you  must  avoid

causing  Fead-Back nesting where a Macro  could  be  defined

within  its self either directly or indirectly. If something

like  this happens we cab not predict what DigiLab will  do,

so  please  do  not try such a thing, it is  not  a  bug  in

DigiLab, it is just wrong and should not be done. You should

also  avoid deleting a macro that another circuit  or  macro

use,  otherwise  DigiLab won't find  this  Macro  and  won't

function properly.

     

Divide and Conquer

     For  professional programmers that design  thier  logic

circuit  according  to the famous modular Divide-and-Conquer

technique,  they  will find Macro very  highly  modular  and

supporting for this method of design. WE RECOMMEND that  you

use macros whenever possible, but you have to test them 100%

and  make  them as modular as possible adding  to  them  all

important  actuating  inputs externally  not  internally.  A

macro  should  not  have  uncontrollled  internal  actuating

elements, like clocks for example.

     

Summary

     In   this   chapter  we  teached  you   all   necessary

information to create and use Macros. We also wmphasized the

relation  between Macros and modular desgin  techniques.  We

RECOMMEND that you keep the tips we said about Macro in mind

whenever  you are generating a new Macro. We also  recommend

the  use  of Macros as much as possible specially for  large

projects.

     

DigiLab Version 2:

     We  hope  you enjoy using our DigiLab. DigiLab sponsors

alot  of  ingenious ideas that we have sololy  created  from

scratch.  We  are currently working on the next  version  of

DigiLab  and  it will have alot of additoinal features  that

miss this version. These Features are:

     

       Mouse Support.

       Graphics Support.

       Macro Frame Editing.

       Drafting Support.

       Printing Support.

       Better File Managment.

       A new PROJECT Feature for managing complex projects.

       Saving of Time Diagrams.

       History   Recording  and  Play-Back  simulation   for

       better circuit debugging.

       Even better on-line circuit information compression.

_______________________________
1 A Macro is a modular structure similar to the IC, and will
be discussed in detail latter.
1Unfortunatly,  CGA  cards  do  not  allow   character   set
redefinition,  and  can  not  be  used  with  this  software
product.
1  Hot  Keys  are keys which represent shortcuts to  actions
which the user could select from the menus.
1 By Active circuit we mean the opened circuit whose name is
displayed in the Circuit Status Area.
1 If there is no circuits in memory the circuit name becomes
"No Circuit".
1  <F2> saves the circuit with its current name, and doesn't
request for a new name.
1  To  speed  up  work,  we recommend that  you  study  the,
pressing 'L', shorcut hot-key.
1 The Default Delay is zero unless you change it.
1  In  DigiLab we didn't use the conventional Dot=Connection
because  upon  query  of a sample of students  who  may  use
DigiLab  we  found  that they prefer the Jump-Over  Junction
rather than the Dot=Connection convention.
1  We note that DigiLab works at logic levels only, thus for
timing  diagrams DigiLab doesn't simulate the exact waveform
as that for a real element, on the other hand it displays  a
waveform of a rectangular nature.
