home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff229.lzh / Sim / english.docs / xdc.doc < prev    next >
Text File  |  1989-07-20  |  13KB  |  535 lines

  1.  
  2.  
  3.  
  4.             XDC - External Device Compiler - and
  5.             DDL - Device Definition Language
  6.  
  7.  
  8.  
  9.  
  10.       Contents:
  11.  
  12.  
  13.       1  Introduction:
  14.  
  15.       2  External Devices
  16.       2.1  Combinatorial circuits
  17.       2.2  Asynchronous sequential logic systems
  18.       2.3  Synchronous sequential logic systems
  19.  
  20.       3  Description of XDC and DDL
  21.       3.1  Call of XDC
  22.       3.2  Syntax of DDL
  23.          3.2.1  Keywords
  24.          3.2.2  Syntaxdiagrams
  25.  
  26.       4  Error messages
  27.  
  28.       5  Acknowledgements
  29.  
  30.  
  31.  
  32.  
  33.  
  34.       1  Introduction:
  35.  
  36.  
  37.       XDC and DDL allow to define external devices for the register trans-
  38.       fer net simulator Sim (V4.0 and higher). With XDC it is possible to
  39.       increase the number of devices that can be simulated. It is also pos-
  40.       sible to increase the speed of the simulation if parts of a register
  41.       transfer net are combined in new, complexer components. New devices
  42.       can be combinatorial circuits, asynchronous, and synchronous sequen-
  43.       tial logic systems.
  44.  
  45.  
  46.  
  47.  
  48.  
  49.       2  External Devices
  50.  
  51.       Fundamental it is possible to define any given device. With synchro-
  52.       nous sequential logic systems it is necessary to consider the sequen-
  53.       tial handling of the devices (see 2.3).
  54.  
  55.  
  56.  
  57.       2.1  Combinatorial circuits
  58.  
  59.  
  60.       Example of an AND device with four inputs:
  61.  
  62.          device x_and;
  63.  
  64.          input  in1,in2,in3,in4;
  65.          output out;
  66.  
  67.          {
  68.             out = in1 & in2 & in3 & in4;
  69.          }
  70.  
  71.  
  72.  
  73.       2.2  Asynchronous sequential logic systems
  74.  
  75.  
  76.       Example of an asynchronous automat:
  77.  
  78.          Automat graph:
  79.  
  80.                     ___                   ___
  81.               +--- /   \       1/0       /   \ ---+
  82.           0/0 |    | 0 | --------------> | 1 |    | 1/0
  83.               +--> \___/                 \___/ <--+
  84.  
  85.                      A                     |
  86.                      |                     |
  87.                  0/0 |                     | 0/0
  88.                      |                     |
  89.                      |                     V
  90.                     ___                   ___
  91.               +--- /   \       1/1       /   \ ---+
  92.           1/1 |    | 3 | <-------------- | 2 |    | 0/0
  93.               +--> \___/                 \___/ <--+
  94.  
  95.  
  96.          Definition:
  97.  
  98.  
  99.          device auto;
  100.  
  101.          input  in;
  102.          output out;
  103.          state  s;
  104.  
  105.          {
  106.             switch (s) {
  107.              case 0:
  108.                if (in & 1)
  109.                   s = 1;
  110.                break;
  111.              case 1:
  112.                if (~in & 1)
  113.                   s = 2;
  114.                break;
  115.              case 2:
  116.                if (in & 1) {
  117.                   s = 3;
  118.                   out = 1;
  119.                }
  120.                break;
  121.              case 3:
  122.                if (~in & 1) {
  123.                   s = 0;
  124.                   out = 0;
  125.                }
  126.                break;
  127.             }
  128.          }
  129.  
  130.  
  131.  
  132.       2.3  Synchronous sequential logic systems
  133.  
  134.  
  135.       With sysnchronous sequential logic systems the value of the input
  136.       leads have to be buffered. Due to the forced sequencing of the devices
  137.       the input values must not be assigned directly to the outputs. If this
  138.       is done, a second register that is connected to the output of the first
  139.       will read the new but wrong value.
  140.  
  141.       Example of a positive-edge-triggered D-Register:
  142.  
  143.          device x_reg;
  144.          input  c,d;
  145.          output q;
  146.          state  s;
  147.  
  148.          {
  149.             if (c & 1)
  150.                q = s;
  151.             else
  152.                s = d;
  153.          }
  154.  
  155.  
  156.  
  157.  
  158.  
  159.       3  Description of XDC and DDL
  160.  
  161.  
  162.       XDC transforms the device definition to C source code which must be
  163.       compiled afterwards. Up to now only the AZTEC compiler is tested.
  164.       Generally spoken, the compiler must generate code using 16-bit-
  165.       integers with LARGE DATE (AZTEC: +D) memory model. For the LATTICE
  166.       compiler the file xcomp have to be changed.
  167.  
  168.  
  169.  
  170.       3.1  Call of XDC
  171.  
  172.  
  173.       For the usage of XDC a AZTEC compiler and linker is needed. The direc-
  174.       tory, in which XDC lies, must contain the following files:
  175.  
  176.          xcomp, sim.h, sim_msg.h
  177.  
  178.       XDC is started by the following statement:
  179.  
  180.          Execute xcomp <device>
  181.  
  182.       The file, containing the device definition, must have the name
  183.       <device>.x. .x must not be given on the call of xcomp.
  184.  
  185.       xcomp generates a file <device>. This file is the new external device.
  186.       This means this new device can be used in a VLI. The input and output
  187.       lead name have to be given in the sequence of their definition in
  188.       <device>.x. The file <device> should be copied to the directory that
  189.       contains the simulator.
  190.  
  191.  
  192.  
  193.       3.2  Syntax of DDL
  194.       3.2.1  Keywords
  195.  
  196.  
  197.       The DDL uses the following keywords:
  198.  
  199.          BREAK    CASE     DEFAULT  DEVICE   ELSE
  200.          IF       INPUT    OUTPUT   STATE    SWITCH
  201.  
  202.       The keyword can be written in capitals or non-capitals (also mixed).
  203.  
  204.  
  205.  
  206.       3.2.2  Syntaxdiagrams
  207.  
  208.  
  209.       file:
  210.  
  211.       --> device_definition -->
  212.  
  213.  
  214.       device_definition:
  215.  
  216.       --> DEVICE --> identifier --> ';' --> declaration_list --+
  217.                                                                |
  218.           +------------------------<---------------------------+
  219.           |
  220.           +--> '{' --> statement_list --> '}' -->
  221.  
  222.  
  223.       comment:
  224.  
  225.       --> '/*' ---+----------------+--> '*/' -->
  226.                   A                |
  227.                   +-- character <--+
  228.  
  229.  
  230.       declaration_list:
  231.  
  232.       --> input_declaration_list --> output_declaration_list --+
  233.                                                                |
  234.           +-------------------------<--------------------------+
  235.           |
  236.           +--> state_declaration_list --+-->
  237.           |                             A
  238.           +--------------->-------------+
  239.  
  240.  
  241.       input_declaration_list:
  242.  
  243.       --+--> input_declaration --+-->
  244.         A                        |
  245.         +------------<-----------+
  246.  
  247.  
  248.       input_declaration:
  249.  
  250.       --> INPUT --> identifier_list --> ';' -->
  251.  
  252.  
  253.       output_declaration_list:
  254.  
  255.       --+--> output_declaration --+-->
  256.         A                         |
  257.         +-------------<-----------+
  258.  
  259.  
  260.       output_declaration:
  261.  
  262.       --> OUTPUT --> identifier_list --> ';' -->
  263.  
  264.  
  265.       state_declaration_list:
  266.  
  267.       --+--> state_declaration --+-->
  268.         A                        |
  269.         +------------<-----------+
  270.  
  271.  
  272.       state_declaration:
  273.  
  274.       --> STATE --> identifier_list --> ';' -->
  275.  
  276.  
  277.       identifier_list:
  278.  
  279.       --+--> identifier --+-->
  280.         A                 |
  281.         +------ ',' <-----+
  282.  
  283.  
  284.       identifier:
  285.  
  286.       --> letter --+------->------+-->
  287.                    A              |
  288.                    +<-- letter <--+
  289.                    |              |
  290.                    +---- digit <--+
  291.  
  292.  
  293.       letter:
  294.  
  295.       --+--> 'A' ---+-->
  296.         |     .     A
  297.         |     .     |
  298.         |           |
  299.         +--> 'Z' -->+
  300.         |           |
  301.         +--> 'a' -->+
  302.         |     .     |
  303.         |     .     |
  304.         |           |
  305.         +--> 'z' -->+
  306.         |           |
  307.         +--> '_' ---+
  308.  
  309.  
  310.       digit:
  311.  
  312.       --+--> '0' --+-->
  313.         |     .    A
  314.         |     .    |
  315.         |          |
  316.         +--> '9' --+
  317.  
  318.  
  319.       statement_list:
  320.  
  321.       --+--> statement --+-->
  322.         A                |
  323.         +--------<-------+
  324.  
  325.  
  326.       statement:
  327.  
  328.       --+--> switch_statement ------>+-->
  329.         |                            A
  330.         +--> if_statement ---------->+
  331.         |                            |
  332.         +--> assignment_statement -->+
  333.         |                            |
  334.         +----------> ';' ------------+
  335.  
  336.  
  337.       assignment_statement:
  338.  
  339.       --> identifier --> '=' --> expression --> ';' -->
  340.  
  341.  
  342.       expression:
  343.  
  344.       --+--> expression -------------------------------+-->
  345.         |                                              A
  346.         +--> '~' --> expression ---------------------->+
  347.         |                                              |
  348.         +--> constant -------------------------------->+
  349.         |                                              |
  350.         +--> identifier ------------------------------>+
  351.         |                                              |
  352.         +--> '(' --> expression --> ')' -------------->+
  353.         |                                              |
  354.         +--> expression --> operator --> expression ---+
  355.  
  356.  
  357.       operator:
  358.  
  359.       --+--> '>' --->+-->
  360.         |            A
  361.         +--> '<' --->+
  362.         |            |
  363.         +--> '>=' -->+
  364.         |            |
  365.         +--> '<=' -->+
  366.         |            |
  367.         +--> '==' -->+
  368.         |            |
  369.         +--> '!=' -->+
  370.         |            |
  371.         +--> '&' --->+
  372.         |            |
  373.         +--> '|' --->+
  374.         |            |
  375.         +--> '^' --->+
  376.         |            |
  377.         +--> '+' --->+
  378.         |            |
  379.         +--> '-' --->+
  380.         |            |
  381.         +--> '>>' -->+
  382.         |            |
  383.         +--> '<<' ---+
  384.  
  385.  
  386.       if_statement:
  387.  
  388.       --> IF --> '(' --> expression --> ')' --> if_else_statement_list--+
  389.                                                                         |
  390.           +-----------------------------<-------------------------------+
  391.           |
  392.           +--> ELSE --> if_else_statement --+-->
  393.           |                                 A
  394.           +----------------->---------------+
  395.  
  396.  
  397.       if_else_statement_list:
  398.  
  399.       --+--> statement -----------------------+-->
  400.         |                                     A
  401.         +--> '{' --> statement_list --> '}' --+
  402.  
  403.  
  404.       switch_statement:
  405.  
  406.       --> SWITCH --> '(' --> expression --> ')' --> switch_statement_list -->
  407.  
  408.  
  409.       switch_statement_list:
  410.  
  411.       --> '{' --+--> case_statment --+---+--> default_statement --+--> '}' -->
  412.                 A                    |   |                        A
  413.                 +----------<---------+   +------------>-----------+
  414.  
  415.  
  416.       case_statement:
  417.  
  418.       --> CASE --> constant --> ':' --+--> statement_list --+--+
  419.                                       |                     A  |
  420.                                       +---------->----------+  |
  421.                                                                |
  422.           +--------------------------<-------------------------+
  423.           |
  424.           +--> BREAK --> ';' --+-->
  425.           |                    A
  426.           +--------------------+
  427.  
  428.  
  429.       default_statement:
  430.  
  431.       --> DEFAULT --> ':' --+--> statement_list --+---+--> BREAK --+-->
  432.                             |                     A   |            A
  433.                             +---------->----------+   +------>-----+
  434.  
  435.  
  436.       constant:
  437.  
  438.       --+--> hexadecimal_constant --+-->
  439.         |                           A
  440.         +--> decimal_constant-------+
  441.  
  442.  
  443.       hexadecimal_constant:
  444.  
  445.                         +----------<---------+
  446.                         V                    |
  447.       --+--> '0x' --+---+---+--> digit --+---+-->
  448.         |           A       |            A
  449.         +--> '0X' --+       +--> 'A' --->+
  450.                             |     .      |
  451.                             |     .      |
  452.                             |            |
  453.                             +--> 'F' --->+
  454.                             |            |
  455.                             +--> 'a' --->+
  456.                             |     .      |
  457.                             |     .      |
  458.                             |            |
  459.                             +--> 'f' ----+
  460.  
  461.  
  462.       decimal_constant:
  463.  
  464.       --+--> '0' -----------------------------+-->
  465.         |                                     A
  466.         +--> positive_digit --+--> digit --+--+
  467.                               A            |
  468.                               +------<-----+
  469.  
  470.  
  471.       positive_digit:
  472.  
  473.       --+--> '1' --+-->
  474.         |     .    A
  475.         |     .    |
  476.         |          |
  477.         +--> '9' --+
  478.  
  479.  
  480.  
  481.  
  482.  
  483.       4  Error messages
  484.  
  485.  
  486.       There are three classes of errors:
  487.  
  488.          a) parse errors without description
  489.  
  490.  
  491.          b) parse errors with description
  492.  
  493.             '=' expected
  494.             '(' expected
  495.             ')' expected
  496.             '{' expected
  497.             '}' expected
  498.             ';' expected
  499.             ':' expected
  500.             constant expected
  501.             lead name expected
  502.  
  503.  
  504.          c) semantical errors
  505.  
  506.             BREAK outside of SWITCH
  507.             CASE outside of SWITCH
  508.             DEFAULT outside of SWITCH
  509.             no CASE behind DEFAULT
  510.             missing CASE
  511.             duplicate CASE
  512.             duplicate DEFAULT
  513.             already defined lead name
  514.             undefined lead
  515.             device name differs from file name
  516.             no memory
  517.  
  518.  
  519.       Error should be corrected from the start to the end because there are
  520.       often succeeding errors. Succeeding error occur mostly with the clas-
  521.       ses a) and b), seldom with c).
  522.  
  523.  
  524.  
  525.  
  526.  
  527.       5  Acknowledgements
  528.  
  529.  
  530.       Sim, XDC, and DDL owe to Klaus-Dieter Renner whose idea and design of
  531.       a register transfer net simulator and a device definition language
  532.       gives the stimulation for my programs, and to Michael Koch for beta-
  533.       testing and his suggestions of new features.
  534.  
  535.