<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m10662">
  <name>Digital Transmitter: Processor Optimization Exercise for Frequency Shift Keying</name>
  <metadata>
  <md:version>2.4</md:version>
  <md:created>2004/02/24 16:33:13.455 US/Central</md:created>
  <md:revised>2003/07/30 15:51:35.589 GMT-5</md:revised>
  <md:authorlist>
    <md:author id="rlmorris">
      <md:firstname>Robert</md:firstname>
      <md:othername>L.</md:othername>
      <md:surname>Morrison</md:surname>
      <md:email>rlmorris@uiuc.edu</md:email>
    </md:author>
    <md:author id="kleffner">
      <md:firstname>Matt</md:firstname>
      
      <md:surname>Kleffner</md:surname>
      <md:email>kleffner@uiuc.edu</md:email>
    </md:author>
    <md:author id="frutiger">
      <md:firstname>Michael</md:firstname>
      
      <md:surname>Frutiger</md:surname>
      <md:email>frutiger@uiuc.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="rlmorris">
      <md:firstname>Robert</md:firstname>
      <md:othername>L.</md:othername>
      <md:surname>Morrison</md:surname>
      <md:email>rlmorris@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="kleffner">
      <md:firstname>Matt</md:firstname>
      
      <md:surname>Kleffner</md:surname>
      <md:email>kleffner@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer id="frutiger">
      <md:firstname>Michael</md:firstname>
      
      <md:surname>Frutiger</md:surname>
      <md:email>frutiger@uiuc.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>communications</md:keyword>
    <md:keyword>transmitter</md:keyword>
    <md:keyword>frequency shift keying</md:keyword>
    <md:keyword>processor</md:keyword>
    <md:keyword>C</md:keyword>
    <md:keyword>assembly</md:keyword>
    <md:keyword>optimization</md:keyword>
    <md:keyword>pseudo-noise</md:keyword>
    <md:keyword>digital signal processing</md:keyword>
  </md:keywordlist>

  <md:abstract>Students are to implement and optimize a frequency shift keying (FSK) digital transmitter and pseudo-noise (PN) sequence generator.  </md:abstract>
</metadata>


  <content>

    <para id="para1">
      In this lab you are to implement and optimize the
      <term>frequency shift keying</term> (<term>FSK</term>) digital
      transmitter and <term>pseudo-noise</term> (<term>PN</term>)
      sequence generator shown in <cnxn document="m10559" target="trans">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 id="sec1">
      <name>Implementation</name>

      <para id="para2">
        You will implement and optimize the complete system shown in
        <cnxn document="m10559" target="trans">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 id="sec1sub1">
        <name>PN Generator</name>

        <para id="para3">
          Once you have planned your program strategy, implement the
          PN generator from <cnxn document="m10559" target="pn-gen">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 <cite>Section 2-2</cite> of the
          <cite>C54x Mnemonic Instruction Set</cite> reference.
          Initialize the shift register to one.
        </para>

        <para id="para4">
          In testing the PN generator, you may find the file <link src="http://cnx.rice.edu/modules/m10662/latest/pn_output.mat"><code>v:\ece320\54x\dspclib\pn_output.mat</code></link>
          helpful.  To use it, type <code>load
          v:\ece320\54x\dspclib\pn_output</code> at the Matlab command
          prompt.  This will load a vector <code>pn_output</code> 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 id="sec1sub2">
        <name>Transmitter</name>

        <para id="para5">
          For your transmitter implementation you are to use the
          data-block-to-carrier-frequency mapping in <cnxn document="m10559" target="table1">this table</cnxn> and a
          digital symbol period of
          <m:math>
            <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 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 <code>Memory</code> option from
          the <code>View</code> menu to view the contents of memory.
          The vector signal analyzer (VSA) provides another method of
          testing.
        </para>
      </section>

      <section id="sec1sub3">
        <name>Testing with the VSA</name>

        <para 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>
	<section id="new1">
	  <name>Configuring the VSA</name>
	  <para id="para8">
	    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 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 type="note">If this
	      doesn't work, hit "Save/Recall," F7 (Catalog), point at
	      <code>ECE320.STA</code> with the wheel, and hit F5 (Recall
	      State) and F1 (Enter).</note>

	    <list id="list1" type="bulleted">
	      <item>"Freq" button, followed by F1 (center), 11.025 (on the
		keypad), and F3 (KHz) </item>
	      <item>F2 (span), 22, and F3 (KHz) </item>
	      <item>"Range," then F5 (ch1 autorange up/down)</item>
	      <item>"Instrument Mode," then F3 (demodulation) </item>
	    </list>
	  </para>
	</section>
	<section id="new2">
	  <name>Viewing the signal spectrum on the VSA</name>
	  <para id="para10">
	    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 id="para11">
	    Does what you see match the Matlab simulations?
	  </para>
	</section>
      </section>

      <section id="sec1sub4">
        <name>Optimization</name>

        <para id="para12">
          One purpose of this lab is to teach optimization and
          efficient code techniques. For this reason, for your lab
          grade <emphasis>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
          <code>stm</code>, and instructions using direct addressing
          of memory (such as <code>ld *(temp),A</code>). 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
          <code>.lst</code> file or the disassembly window in the
          debugger.
        </para>

        <para id="para13">
          We will grade you based on the number of cycles used between
          the return from the <code>WAITDATA</code> call and the
          arrival at the next <code>WAITDATA</code> 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
          <code>core.asm</code> file in
          <code>v:\ece320\54x\dsplib\core.asm</code> or the C core
          file in <code>v:\ece320\54x\dspclib\core.asm</code> as
          provided by the TAs; <emphasis>these files may not be
          modified</emphasis>.  You explicitly may not change the
          number of samples read and written by each
          <code>WAITDATA</code> or WaitAudio call! We reserve the
          right to test your code by substituting the test vector core
          file.
        </para>
      </section>
    </section>

    <section id="sec2">
      <name>Grading</name>

      <para 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 id="para16">
        Grading for this lab will be a bit different from past labs:

        <list id="list2" type="bulleted">
          <item> 1 point: Prelab</item>
          <item> 2 points: Working code, implemented from scratch in assembly
	    language or C. </item>
          <item> 5 points: Optimization. These points will be assigned based
	    on your cycle counts and the optimizations you have made. </item>
          <item> 2 points: Oral quiz. </item>
        </list>
      </para>
    </section>

  </content>
  
</document>
