<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE module PUBLIC "-//CNX//DTD CNXML 0.4 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.4/DTD/cnxml_mathml.dtd">
<module xmlns="http://cnx.rice.edu/cnxml/0.4" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="m10662">
  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Digital Transmitter: Processor Optimization Exercise for Frequency Shift Keying</name>
  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML">2.2</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML">2002/06/09</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML">2002-09-05</md:revised>

  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML">
    <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" id="mjberry">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML">Matthew</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML">J.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML">Berry</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML">mjberry@uiuc.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" id="mjberry">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML">Matthew</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML">J.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML">Berry</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML">mjberry@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" id="butala">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML">Mark</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML">D.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML">Butala</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML">butala@uiuc.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist xmlns:m="http://www.w3.org/1998/Math/MathML">
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">communications</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">transmitter</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">frequency shift keying</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">processor</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">C</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">assembly</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">optimization</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">pseudo-noise</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML">digital signal processing</md:keyword>
  </md:keywordlist>

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML">Students are to implement and optimize a frequency shift keying (FSK) digital transmitter and pseudo-noise (PN) sequence generator.  </md:abstract>
</metadata>


  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para1">
      In this lab you are to implement and optimize the frequency shift keying
      (FSK) digital transmitter and pseudo-noise (PN) sequence generator shown
      in <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" module="m10559" target="trans" strength="7">this figure</cnxn>.
      For the lab grade, you will be judged on the execution time of your
      system (memory usage need not be minimized).
    </para>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="sec1">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Implementation</name>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para2">
        You will implement and optimize the complete system shown in 
        <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" module="m10559" target="trans" strength="7">this figure</cnxn>.
        over the next two weeks.  You may write in C, assembly, or any
        combination of the two; choose whatever will allow you to write the
        fastest code.  The optimization process will probably be much easier
        if you plan for optimization before you begin any programming.
      </para>

      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="sec1sub1">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">PN Generator</name>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para3">
          Once you have planned your program strategy, implement the PN 
          generator from 
          <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" module="m10559" target="pn-gen" strength="7">Figure 2</cnxn>
          and verify that it is working.  If you are programming in assembly,
          you may wish to refer to the description of assembly instructions 
          for logical operations in Section 2-2 of the C54x Mnemonic
          Instruction Set reference.  Initialize the shift register to one.  
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para4">
          In testing the PN generator, you may find the file 
          <link xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" src="http://cnx.rice.edu/modules/m10662/latest/pn_output.mat"><codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">v:\ece320\54x\dspclib\pn_output.mat</codeline></link> helpful.  
          To use it, type 
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">load v:\ece320\54x\dspclib\pn_output</codeline>
          at the Matlab command prompt.  This will load a vector 
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">pn_output</codeline> into memory.  The vector contains 500
          elements, which are the first 500 output bits of the PN generator.
          Be prepared to prove to a TA that your PN generator works properly
          as part of your quiz.
        </para>
      </section>

      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="sec1sub2">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Transmitter</name>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para5">
          For your transmitter implementation you are to use the 
          data-block-to-carrier-frequency mapping in 
          <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" module="m10559" target="table1" strength="7">this table</cnxn>
          and a digital symbol period of 
          <m:math display="inline">
            <m:apply>
              <m:eq/>
                <m:ci>
                  <m:msub>
                    <m:mi>T</m:mi>
                    <m:mi>symb</m:mi>
                  </m:msub>
                </m:ci>
                <m:cn>32</m:cn>
            </m:apply>
          </m:math> samples.
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para6">
          Viewing the transmitted signal on the oscilloscope may help you
          determine whether your code works properly, but you should check it
          more carefully by setting breakpoints in Code Composer and using
          the <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Memory</codeline> option from the
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">View</codeline> menu to view the contents of memory.  The
          vector signal analyzer (VSA) provides another method of testing. 
        </para>
      </section>

      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="sec1sub3">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Testing with the VSA</name>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para7">
          The VSA is an instrument capable of demodulating digital signals.
          You may use the VSA to demodulate your FSK signal and display the 
          symbols received.
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para8">
          Configuring the VSA:  The VSA is the big HP unit on a cart in the
          front of the classroom. Plug the output from the DSP board into the
          ``Channel 1'' jack on the front of the vector signal analyzer, and 
          then turn on the analyzer and follow these instructions to display 
          your output:
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para9">
          After powering the signal analyzer up, the display will not be in the
          correct mode. Use the following sequence of keypresses to set it up
          properly: <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" type="note">If this doesn't work, hit 
          ``Save/Recall,'' F7 (Catalog), point at ``ECE320.STA'' with the
          wheel, and hit F5 (Recall State) and F1 (Enter).</note>

          <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="list1" type="bulleted">
            <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">``Freq'' button, followed by F1 (center), 11.025 (on the
               keypad), and F3 (KHz) </item>
            <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">F2 (span), 22, and F3 (KHz) </item>
            <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">``Range,'' then F5 (ch1 autorange up/down)</item>
            <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">``Instrument Mode,'' then F3 (demodulation) </item>
          </list>
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para10">
          Viewing the signal spectrum on the VSA: The VSA is also capable of
          displaying the spectrum of a signal.  Hook up the output of your PN
          generator to the VSA and set it up properly to view the spectrum of
          the random sequence.  Hit ``Instrument Mode'' and then F1 (Scalar) 
          to see the spectrum.  Note that you can also use your Lab 4 code for
          this purpose.
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para11">
          Does what you see match the Matlab simulations?
        </para>
      </section>

      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="sec1sub4">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Optimization</name>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para12">
          One purpose of this lab is to teach optimization and efficient
          code techniques. For this reason, for your lab grade 
          <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">you will be judged primarily on the total execution
          time of your system.</emphasis> You are not required to optimize
          memory use.  Note that by execution time we mean cycle count, not
          the number of instructions in your program. Remember that several
          of the TMS320C54xx instructions take more than one cycle. The
          multicycle instructions are primarily the multi-word instructions, 
          including instructions that take immediates, like 
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">stm</codeline>, and instructions using direct addressing
          of memory (such as <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">ld *(temp),A</codeline>). Branch and
          repeat statements also require several cycles to execute.  Most C 
          instructions take more than one cycle. The debugger can be used to
          determine the exact number of cycles used by your code; ask your TA
          to demonstrate. However, since the number of execution cycles used
          by an instruction is usually determined by the number of words in
          its encoding, the easiest way to estimate the number of cycles used
          by your code is to count the number of instruction words in the
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">.lst</codeline> file or the disassembly window in the
          debugger.
        </para>

        <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para13">
          We will grade you based on the number of cycles used between the
          return from the WAITDATA call and the arrival at the next WAITDATA 
          call in assembly, or the return from one WaitAudio call and the
          arrival at the next WaitAudio call in C. If the number of cycles
          between the two points  is variable, the maximum possible number of
          cycles will be counted. You must use the 
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">core.asm</codeline> file in 
          <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">v:\ece320\54x\dsplib\core.asm</codeline> or the C core file
          in <codeline xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">v:\ece320\54x\dspclib\core.asm</codeline> as provided 
          by the TAs; <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">these files may not be modified</emphasis>.
          You explicitly may not change the number of samples read and written
          by each WAITDATA or WaitAudio call! We reserve the right to test
          your code by substituting the test vector core file.
        </para>
      </section>
    </section>

    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="sec2">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML">Grading</name>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para15">
        This is a two-week lab. Your prelab is due a week after the quiz for
        Lab 4, and the quizzing occurs two weeks after the quiz for Lab 4. 
      </para>

      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="para16">
        Grading for this lab will be a bit different from past labs:

        <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" id="list2" type="bulleted">
          <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML"> 1 point: Prelab</item>
          <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML"> 2 points: Working code, implemented from scratch in assembly
             language or C. </item>
          <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML"> 5 points: Optimization. These points will be assigned based
             on your cycle counts and the optimizations you have made. </item>
          <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML"> 2 points: Oral quiz. </item>
        </list>
      </para>
    </section>

  </content>
  
</module>
