<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://zeus.phys.uconn.edu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Krueger</id>
	<title>UConn PAN - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://zeus.phys.uconn.edu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Krueger"/>
	<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Special:Contributions/Krueger"/>
	<updated>2026-04-23T14:52:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.7</generator>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_FPGA&amp;diff=2204</id>
		<title>Programming the FPGA</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_FPGA&amp;diff=2204"/>
		<updated>2007-07-20T19:53:57Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Spartan.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
The FPGA is the hub of the digital control board and all other chips are connected to and controlled by it.  This article discusses the programming of the FPGA.  All code is written in [[VHDL_tutorial|VHDL]].  For the purposes of testing, each chip has not only a controller written for it, but an emulator as well.&lt;br /&gt;
&lt;br /&gt;
== Open questions ==&lt;br /&gt;
&lt;br /&gt;
Programming of the FPGA is an ongoing project, so more questions may be added as the project develops.&lt;br /&gt;
* What is the clock speed of the FPGA?  Timing constraints must be taken into account to link the multiple blocks.&lt;br /&gt;
* Current designs (11 July, 2007) account for normal activity.  Need to design modules/logic for startup and initialization of each component.  This should not be only on startup; we should be able to send a reset packet over Ethernet to trigger a reinitialization of each chip.  ''Work in progress'': see [[Reset and Initialization]].&lt;br /&gt;
* Do the parts work on falling or rising edges of the clock?  Most VHDL designs are currently on rising edges, but this can be easily corrected.&lt;br /&gt;
* The temperature sensor and the ADC share the same SPI-like bus lines; can they be combined into a single VHDL design?&lt;br /&gt;
* A core VHDL module is needed to tie all the components together.  The Ethernet controller module may take on the role of FPGA core.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
* [[Programming the DAC]]&lt;br /&gt;
* [[Programming the SPI]]&lt;br /&gt;
* [[Programming the Ethernet controller]]&lt;br /&gt;
* [[Reset and Initialization]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2203</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2203"/>
		<updated>2007-07-20T19:52:08Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Internal Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
&lt;br /&gt;
==== Programming our FPGA ====&lt;br /&gt;
&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the SPI]] - discussion of the new hybrid module that controls both the ADC and the temperature sensor over a single SPI bus.&lt;br /&gt;
*** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
*** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
&lt;br /&gt;
==== VHDL in general ====&lt;br /&gt;
&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** &amp;lt;S&amp;gt;Integrate with/''combine into'' existing modules&amp;lt;/S&amp;gt; ''update'': integrated into [[Programming_the_Ethernet_controller#.28000.29_Reset_Cycle|Ethernet module]]&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2202</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2202"/>
		<updated>2007-07-20T19:46:46Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* To-do list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
&lt;br /&gt;
==== Programming our FPGA ====&lt;br /&gt;
&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the SPI]] - discussion of the new hybrid module that controls both the ADC and the temperature sensor over a single SPI bus.&lt;br /&gt;
*** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
*** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
&lt;br /&gt;
==== VHDL in general ====&lt;br /&gt;
&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** &amp;lt;S&amp;gt;Integrate with/''combine into'' existing modules&amp;lt;/S&amp;gt; ''update'': integrated into [[Programming_the_Ethernet_controller#.28000.29_Reset_Cycle|Ethernet module]]&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2201</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2201"/>
		<updated>2007-07-20T19:43:55Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* To-do list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
&lt;br /&gt;
==== Programming our FPGA ====&lt;br /&gt;
&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the SPI]] - discussion of the new hybrid module that controls both the ADC and the temperature sensor over a single SPI bus.&lt;br /&gt;
*** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
*** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
&lt;br /&gt;
==== VHDL in general ====&lt;br /&gt;
&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** &amp;lt;S&amp;gt;Integrate with/''combine into'' existing modules&amp;lt;/S&amp;gt; ''update'': integrated into Ethernet module&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2200</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2200"/>
		<updated>2007-07-20T19:43:41Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* To-do list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
&lt;br /&gt;
==== Programming our FPGA ====&lt;br /&gt;
&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the SPI]] - discussion of the new hybrid module that controls both the ADC and the temperature sensor over a single SPI bus.&lt;br /&gt;
*** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
*** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
&lt;br /&gt;
==== VHDL in general ====&lt;br /&gt;
&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** &amp;lt;S&amp;gt;Integrate with/''combine into'' existing modules&amp;lt;/S&amp;gt; Update: integrated into Ethernet module&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2199</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2199"/>
		<updated>2007-07-20T19:33:09Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
&lt;br /&gt;
==== Programming our FPGA ====&lt;br /&gt;
&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the SPI]] - discussion of the new hybrid module that controls both the ADC and the temperature sensor over a single SPI bus.&lt;br /&gt;
*** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
*** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
&lt;br /&gt;
==== VHDL in general ====&lt;br /&gt;
&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** Integrate with/''combine into'' existing modules&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_SPI&amp;diff=2198</id>
		<title>Programming the SPI</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_SPI&amp;diff=2198"/>
		<updated>2007-07-20T19:28:24Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page discusses a project currently under development.  Please be aware that information on this page may change as the project progresses.'''&lt;br /&gt;
&lt;br /&gt;
This module aims to merge the ADC and temperature sensor modules into a single module.  Both modules communicate over a shared SPI-like bus, and there are many structural and functional similarities between the two.  However, this is a partially completed project.  The current VHDL files (which are mostly written but need to be tested) can be found at:&lt;br /&gt;
* [http://zeus.phys.uconn.edu/halld/tagger/electronics/design-6-2007/SPI_VHDL.zip SPI Module].&lt;br /&gt;
The subprojects (i.e. earlier versions of the separate ADC and temperature sensor modules) can be found at:&lt;br /&gt;
* [http://zeus.phys.uconn.edu/halld/tagger/electronics/design-6-2007/ADC_VHDL.zip ADC Module]&lt;br /&gt;
* [http://zeus.phys.uconn.edu/halld/tagger/electronics/design-6-2007/Temp_VHDL.zip Temperature Sensor Module]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_SPI&amp;diff=2197</id>
		<title>Programming the SPI</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_SPI&amp;diff=2197"/>
		<updated>2007-07-20T19:27:51Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page discusses a project currently under development.  Please be aware that information on this page may change as the project progresses.'''&lt;br /&gt;
&lt;br /&gt;
This module aims to merge the ADC and temperature sensor modules into a single module.  Both modules communicate over a shared SPI-like bus, and there are many structural and functional similarities between the two.  However, this is a partially completed project.  The current VHDL files (which are mostly written but need to be tested) can be found [http://zeus.phys.uconn.edu/halld/tagger/electronics/design-6-2007/SPI_VHDL.zip here].  The subprojects (i.e. earlier versions of the separate ADC and temperature sensor modules) can be found at:&lt;br /&gt;
* [http://zeus.phys.uconn.edu/halld/tagger/electronics/design-6-2007/ADC_VHDL.zip ADC Module]&lt;br /&gt;
* [http://zeus.phys.uconn.edu/halld/tagger/electronics/design-6-2007/Temp_VHDL.zip Temperature Sensor Module]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2196</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2196"/>
		<updated>2007-07-20T19:18:03Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the SPI]] - discussion of the new hybrid module that controls both the ADC and the temperature sensor over a single SPI bus.&lt;br /&gt;
*** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
*** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** Integrate with/''combine into'' existing modules&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2195</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2195"/>
		<updated>2007-07-20T18:41:35Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
'''A discussion of the Multiplexed Intel bus format should be placed here.'''  Until this section is complete, refer to the CP2200/1 data sheet for information.&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.  The transceiver is intended to function on the Multiplexed Intel bus format to communicate with the CP2200/1.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A 16-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 16-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 16-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the only block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* - transceiver control lines -&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''MAC Filter'''&lt;br /&gt;
** This block checks that the MAC address in the packet destination field is the same as the MAC address of the board.  If not the packet is discarded, if so then the MAC data (destination and source MAC address, packet length) are discarded and processing continues.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin&lt;br /&gt;
*** - transceiver control lines -&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Discard'': pulse to State Advance to discard packet and return to 010&lt;br /&gt;
*** ''Continue'': pulse to Switch to continue processing&lt;br /&gt;
*** - transceiver control lines -&lt;br /&gt;
* '''Switch'''&lt;br /&gt;
** This block reads the first data byte of the packet and uses it as a switch to direct the state machine to the appropriate next step.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin&lt;br /&gt;
*** - transceiver control lines -&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Discard'': pulse to State Advance to discard packet and return to 010&lt;br /&gt;
*** ''Reset_000'': pulse to State Advance to discard packet and go to 000&lt;br /&gt;
*** ''Query'': pulse to State Advance to discard packet and go to 100&lt;br /&gt;
*** ''Program'': pulse to State Advance to keep packet and go to 110&lt;br /&gt;
*** - transceiver control lines -&lt;br /&gt;
* '''State Advance'''&lt;br /&gt;
** This block has several ''Go'' lines and based on which is pulsed the next state is set up by loading a new state value into the state register.  It also discards packets other than &amp;quot;P&amp;quot;.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Discard'': pulse to discard packet and return to 010&lt;br /&gt;
*** ''Reset_000'': pulse to discard packet and go to 000&lt;br /&gt;
*** ''Query'': pulse to discard packet and go to 100&lt;br /&gt;
*** ''Program'': pulse to keep packet and go to 110&lt;br /&gt;
*** - transceiver control lines -&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': pulse to signal completion; connects to state register enable&lt;br /&gt;
*** ''New_St'': new state to load to state register; goes to 000, 010, 100, or 110 when ''Done'' is high depending on switching&lt;br /&gt;
*** - transceiver control lines -&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Additionally, it converts all values to 16-bit two's-complement before storing locally.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.  Obtains data from ADC, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.  Obtains data from temperature sensor, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Temp Loader'''&lt;br /&gt;
** This block reads the temperature value from the internal registers and loads it to the transmit buffer.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Go'' internal signal of block 101&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''ADC Loader'''&lt;br /&gt;
** This block reads the ADC values from the internal registers and loads them to the transmit buffer in order: channel zero to channel seven.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Temp Loader&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''Sel'': 3-bit select bus for internal registers&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Padder'''&lt;br /&gt;
** This block pads the packet to the minimum 46 bytes.  Only 19 bytes have been loaded by this point (1 byte &amp;quot;S&amp;quot;, 2 byte temperature, 8 x 2 byte ADC), so 27 bytes of padding (zero) must be loaded.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of ADC Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** This block tells the CP2200/1 to send the completed packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Padder&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Discarder'''&lt;br /&gt;
** This block orders the CP2200/1 to discard the packet, now that the FPGA is done with all the data contained within the packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Programmer&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2194</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2194"/>
		<updated>2007-07-19T20:27:21Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
'''A discussion of the Multiplexed Intel bus format should be placed here.'''  Until this section is complete, refer to the CP2200/1 data sheet for information.&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.  The transceiver is intended to function on the Multiplexed Intel bus format to communicate with the CP2200/1.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A 16-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 16-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 16-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the only block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Additionally, it converts all values to 16-bit two's-complement before storing locally.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.  Obtains data from ADC, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.  Obtains data from temperature sensor, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Temp Loader'''&lt;br /&gt;
** This block reads the temperature value from the internal registers and loads it to the transmit buffer.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Go'' internal signal of block 101&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''ADC Loader'''&lt;br /&gt;
** This block reads the ADC values from the internal registers and loads them to the transmit buffer in order: channel zero to channel seven.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Temp Loader&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''Sel'': 3-bit select bus for internal registers&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Padder'''&lt;br /&gt;
** This block pads the packet to the minimum 46 bytes.  Only 19 bytes have been loaded by this point (1 byte &amp;quot;S&amp;quot;, 2 byte temperature, 8 x 2 byte ADC), so 27 bytes of padding (zero) must be loaded.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of ADC Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** This block tells the CP2200/1 to send the completed packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Padder&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Discarder'''&lt;br /&gt;
** This block orders the CP2200/1 to discard the packet, now that the FPGA is done with all the data contained within the packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Programmer&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2193</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2193"/>
		<updated>2007-07-19T20:26:22Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* Non-State Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.  The transceiver is intended to function on the Multiplexed Intel bus format to communicate with the CP2200/1.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A 16-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 16-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 16-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the only block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Additionally, it converts all values to 16-bit two's-complement before storing locally.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.  Obtains data from ADC, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.  Obtains data from temperature sensor, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Temp Loader'''&lt;br /&gt;
** This block reads the temperature value from the internal registers and loads it to the transmit buffer.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Go'' internal signal of block 101&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''ADC Loader'''&lt;br /&gt;
** This block reads the ADC values from the internal registers and loads them to the transmit buffer in order: channel zero to channel seven.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Temp Loader&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''Sel'': 3-bit select bus for internal registers&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Padder'''&lt;br /&gt;
** This block pads the packet to the minimum 46 bytes.  Only 19 bytes have been loaded by this point (1 byte &amp;quot;S&amp;quot;, 2 byte temperature, 8 x 2 byte ADC), so 27 bytes of padding (zero) must be loaded.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of ADC Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** This block tells the CP2200/1 to send the completed packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Padder&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Discarder'''&lt;br /&gt;
** This block orders the CP2200/1 to discard the packet, now that the FPGA is done with all the data contained within the packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Programmer&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2192</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2192"/>
		<updated>2007-07-19T20:25:24Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (110) Program DAC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A 16-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 16-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 16-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the only block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Additionally, it converts all values to 16-bit two's-complement before storing locally.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.  Obtains data from ADC, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.  Obtains data from temperature sensor, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Temp Loader'''&lt;br /&gt;
** This block reads the temperature value from the internal registers and loads it to the transmit buffer.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Go'' internal signal of block 101&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''ADC Loader'''&lt;br /&gt;
** This block reads the ADC values from the internal registers and loads them to the transmit buffer in order: channel zero to channel seven.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Temp Loader&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''Sel'': 3-bit select bus for internal registers&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Padder'''&lt;br /&gt;
** This block pads the packet to the minimum 46 bytes.  Only 19 bytes have been loaded by this point (1 byte &amp;quot;S&amp;quot;, 2 byte temperature, 8 x 2 byte ADC), so 27 bytes of padding (zero) must be loaded.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of ADC Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** This block tells the CP2200/1 to send the completed packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Padder&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Discarder'''&lt;br /&gt;
** This block orders the CP2200/1 to discard the packet, now that the FPGA is done with all the data contained within the packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Programmer&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2191</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2191"/>
		<updated>2007-07-19T20:22:22Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (011) Read Packet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A 16-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 16-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 16-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the only block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Additionally, it converts all values to 16-bit two's-complement before storing locally.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.  Obtains data from ADC, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.  Obtains data from temperature sensor, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Temp Loader'''&lt;br /&gt;
** This block reads the temperature value from the internal registers and loads it to the transmit buffer.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Go'' internal signal of block 101&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''ADC Loader'''&lt;br /&gt;
** This block reads the ADC values from the internal registers and loads them to the transmit buffer in order: channel zero to channel seven.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Temp Loader&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''Sel'': 3-bit select bus for internal registers&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Padder'''&lt;br /&gt;
** This block pads the packet to the minimum 46 bytes.  Only 19 bytes have been loaded by this point (1 byte &amp;quot;S&amp;quot;, 2 byte temperature, 8 x 2 byte ADC), so 27 bytes of padding (zero) must be loaded.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of ADC Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** This block tells the CP2200/1 to send the completed packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Padder&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2190</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2190"/>
		<updated>2007-07-19T20:21:14Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A 16-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 16-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 16-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Additionally, it converts all values to 16-bit two's-complement before storing locally.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.  Obtains data from ADC, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.  Obtains data from temperature sensor, converts to 16-bit two's-complement, and stores.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 16-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Temp Loader'''&lt;br /&gt;
** This block reads the temperature value from the internal registers and loads it to the transmit buffer.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Go'' internal signal of block 101&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''ADC Loader'''&lt;br /&gt;
** This block reads the ADC values from the internal registers and loads them to the transmit buffer in order: channel zero to channel seven.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Temp Loader&lt;br /&gt;
*** ''D_in'': 16-bit data bus from internal registers&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** ouputs&lt;br /&gt;
*** ''Sel'': 3-bit select bus for internal registers&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Padder'''&lt;br /&gt;
** This block pads the packet to the minimum 46 bytes.  Only 19 bytes have been loaded by this point (1 byte &amp;quot;S&amp;quot;, 2 byte temperature, 8 x 2 byte ADC), so 27 bytes of padding (zero) must be loaded.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of ADC Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** This block tells the CP2200/1 to send the completed packet.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Padder&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2189</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2189"/>
		<updated>2007-07-19T19:46:39Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A ten-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 12-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 14-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; goes to 010 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
*** ''New_St'': new state value to load into state register; goes to 011 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; goes to 111 when ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Loader'''&lt;br /&gt;
** Loads the DAC values into a packet in the transmission buffer of the CP2200/1.  Loops through all values and loads them in order (channel zero to channel thirty-one).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin loading a packet&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
*** ''Data'': 14-bit data bus from internal registers&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
* '''Sender'''&lt;br /&gt;
** Tells CP2200/1 to send the packet&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, connected to ''Done'' signal from Loader&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_RW'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' bus on transceiver&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': 3-bit bus of new state to write to state register; goes to 010 when ''Done'' is high&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2188</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2188"/>
		<updated>2007-07-19T19:36:03Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A ten-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 12-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
* '''DAC registers'''&lt;br /&gt;
** A set of 32/24/16 14-bit registers to store the most recent DAC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 5/5/4-bit select bus&lt;br /&gt;
*** ''D'': 14-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 14-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; tied to 010&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Mask Fetcher'''&lt;br /&gt;
** This block reads the programming mask, contained in the second data byte (first remaining byte) through the 5th/4th/3rd byte (4th/3rd/2nd remaining byte), and saves it into a 32/24/16-bit register.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin, comes from ''Go'' internal signal of block 110&lt;br /&gt;
*** ''TxRx_D'': 8-bit data bus from transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' input on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' input on transceiver; tied to read (one)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Mask'': 32/24/16-bit readout of programming mask&lt;br /&gt;
*** ''Done'': pulse to signal that mask has been obtained&lt;br /&gt;
* '''Programmer'''&lt;br /&gt;
** Programs the DAC.  Loops 32/24/16 times, obtaining the next byte from the CP2200/1 buffer, checking the mask, programming the DAC if the mask is 1 or skipping if the mask is 0.  Also writes the value to the internal DAC value storage registers (or Flash memory or other).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin; feeds from ''Done'' signal of Mask Fetcher&lt;br /&gt;
*** ''TxRx_D'': ''D_out'' bus on transceiver&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' signal on transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** - DAC control lines -&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal on transceiver&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver&lt;br /&gt;
*** ''Sel'': 5/5/4-bit select bus to internal registers&lt;br /&gt;
*** ''Data'': 32/24/16-bit data bus to internal registers&lt;br /&gt;
*** ''Done'': pulse to signal completion&lt;br /&gt;
*** ''New_St'': next state to load into the state register; tied to 111&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2187</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2187"/>
		<updated>2007-07-19T18:49:16Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A ten-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 12-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Transmitter'''&lt;br /&gt;
** Loads an ASCII &amp;quot;I&amp;quot; (0x49, 0100 1001) to the transmitter 46 times (the first value must be &amp;quot;I&amp;quot; and the rest are garbage, so padding with &amp;quot;I&amp;quot; is simplest) to fill in a complete packet (accounts for any register incrementing or other loading control necessary).&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin sending&lt;br /&gt;
*** ''Inc'': ''Done'' signal from transceiver; initiates next sending&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_D'': ''D_in'' signal to transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' signal to transceiver; tied to write (zero)&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' signal to transceiver&lt;br /&gt;
*** ''Done'': pulses for one cycle; connects to state register as an enable line&lt;br /&gt;
*** ''New_St'': new state to load into state register; tied to 010&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2186</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2186"/>
		<updated>2007-07-19T18:13:21Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (001) Transmit &amp;quot;I&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A ten-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 12-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (any value) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2185</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2185"/>
		<updated>2007-07-19T16:34:52Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (100) Poll Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A ten-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 12-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''En'': enable line for writing to the internal registers&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''En'': enable line for writing to the internal register&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2184</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2184"/>
		<updated>2007-07-19T16:33:47Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* Non-State Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
* '''temperature register'''&lt;br /&gt;
** A ten-bit register to store the most recent temperature data.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': ten-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': ten-bit data-out bus&lt;br /&gt;
* '''ADC registers'''&lt;br /&gt;
** A set of eight 12-bit registers to store the most recent ADC data.  Also includes a demultiplexer to select which register to write to.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''S'': 3-bit select bus&lt;br /&gt;
*** ''D'': 12-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': 12-bit data-out bus; outputs data of register chosen by S bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2183</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2183"/>
		<updated>2007-07-19T16:30:30Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (100) Poll Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''A_Done'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
**: Note that the temperature sensor does not signal completion.  That is because the temperature sensor need only update one value, while the ADC must update eight values.  Thus it is known ahead of time that the temperature sensor will already be done by the time the ADC is done.&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2182</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2182"/>
		<updated>2007-07-19T16:24:41Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (100) Poll Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
Currently we assume that data values will be stored in the FPGA.  If data values will be stored on CP2200/1 Flash memory or other storage device, the interfaces and blocks will have to be adjusted appropriately.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''T_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each polling cycle and notifies other blocks that the polling process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done polling&lt;br /&gt;
*** ''T_Done'': high when temperature sensor is done polling&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= ''A_done'' and ''T_Done''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 101 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2181</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2181"/>
		<updated>2007-07-19T16:21:14Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (100) Poll Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''ADC Poll'''&lt;br /&gt;
** Updates values stored in the FPGA from the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''Sel'': 3-bit select bus to specify which ADC channel data is available&lt;br /&gt;
*** ''Data'': 12-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Temp Poll'''&lt;br /&gt;
** Updates value stored in the FPGA from the temperature sensor.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': go pulse to begin&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All temperature sensor control lines -&lt;br /&gt;
*** ''T_Done'': goes high when reset/initialization process is complete, falls on ''Go'' pulse&lt;br /&gt;
*** ''Data'': 10-bit data bus to carry data to FPGA internal registers&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2180</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2180"/>
		<updated>2007-07-19T15:57:15Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (001) Transmit &amp;quot;I&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bytes (minimum size of data is 46 bytes, so there needs to be 45 bytes of padding).  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2179</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2179"/>
		<updated>2007-07-19T15:55:42Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* = Non-State Components */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ===&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2178</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2178"/>
		<updated>2007-07-19T15:55:35Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* = */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2177</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2177"/>
		<updated>2007-07-19T15:55:25Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* Controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
=== Non-State Components&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2176</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2176"/>
		<updated>2007-07-19T15:45:49Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet_packets#The_query_cycle|Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet_packets#The_programming_cycle|Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2174</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2174"/>
		<updated>2007-07-19T15:41:46Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2173</id>
		<title>Design and prototyping of SiPM electronics</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Design_and_prototyping_of_SiPM_electronics&amp;diff=2173"/>
		<updated>2007-07-19T15:41:22Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This page is a work in progress.  More information will be added as the project progresses.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Analog amplifier ===&lt;br /&gt;
* [[SiPM Amplifier]] - analog amplifier circuit supplied by [http://www.photonique.ch/ Photonique] for use with the SiPMs.&lt;br /&gt;
* [[MATLAB amplifier in detail]] - more information regarding the implementation of the MATLAB-based simulation of the amplifier circuit.&lt;br /&gt;
=== Digital control ===&lt;br /&gt;
* [[SiPM digital control board]] - digital PCB for controlling the SiPMs.&lt;br /&gt;
* [[Programming the FPGA]] - central page for programming the FPGA.&lt;br /&gt;
** [[Programming the DAC]] - discussion of the design for the DAC.&lt;br /&gt;
** [[Programming the temperature sensor]] - discussion of the design for the temperature sensor.&lt;br /&gt;
** [[Programming the ADC]] - discussion of the design for the ADC.&lt;br /&gt;
** [[Programming the Ethernet controller]] - discussion of the design for the Ethernet controller.&lt;br /&gt;
*** [[Ethernet packets]] - a detail of the packets we intend to use on our network.&lt;br /&gt;
** [[Reset and Initialization]] - discussion of the design for the reset and initialization core.&lt;br /&gt;
* [[VHDL tutorial]] - a brief guide to VHDL design with a design example; the introduction and core of the tutorial.&lt;br /&gt;
** [[VHDL: Where to start]] - section one of the tutorial, focusing on preparing your design for coding.&lt;br /&gt;
** [[VHDL: Enter the code monkey]] - section two of the tutorial, focusing on outlining the framework of your code.&lt;br /&gt;
** [[VHDL: The real code]] - section three of the tutorial, focusing on coding the body of your design.&lt;br /&gt;
** [[VHDL: Xilinx ISE]] - section four of the tutorial, focusing on using the development environment.&lt;br /&gt;
&lt;br /&gt;
== To-do list ==&lt;br /&gt;
&lt;br /&gt;
* Upload [[Programming the ADC|ADC module]] block diagrams&lt;br /&gt;
* Combine [[Programming the ADC|ADC]] &amp;amp; [[Programming the temperature sensor|temperature sensor]] into single &amp;quot;SPI&amp;quot; module&lt;br /&gt;
* [[Reset and Initialization|Reset module]]&lt;br /&gt;
** Execute on startup&lt;br /&gt;
** Execute on command&lt;br /&gt;
** Integrate with/''combine into'' existing modules&lt;br /&gt;
* Complete [[Programming the Ethernet controller|Ethernet controller module]]&lt;br /&gt;
* Integrate all modules&lt;br /&gt;
* Determine size of FPGA&lt;br /&gt;
* Design or purchase connector to bus board&lt;br /&gt;
* Purchase all components (including EEPROM, RJ-45 female jack, etc)&lt;br /&gt;
* Obtain footprints of all chips, connectors, jacks, etc&lt;br /&gt;
* PCB layout&lt;br /&gt;
* Prototype PCB&lt;br /&gt;
* Design bus board&lt;br /&gt;
* Design [[SiPM Amplifier|analog board]]&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2171</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2171"/>
		<updated>2007-07-19T15:41:00Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (111) Transmit &amp;quot;D&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block loads a &amp;quot;D&amp;quot; to the transmit buffer then loops 32 (or 24 or 16) times to load the locally stored DAC channel values to the transmit buffer.  Once the full packet has been loaded, it sends the packet, then transitions to state 010.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2170</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2170"/>
		<updated>2007-07-19T15:40:39Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (110) Program DAC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
This block will have a substate to obtain the programming mask.  It then loops 32 (or 24 or 16) times on a second substate that obtains the next programming value and, if the corresponding mask bit is high, programs that channel of the DAC.  A mux may be needed to select the appropriate bit from the programming mask.  It also updates the locally stored DAC channel values (which may be stored on the FPGA, the CP2200/1 Flash, or other) in preparation for a &amp;quot;D&amp;quot; response packet.  Then it transitions to state 111.&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2169</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2169"/>
		<updated>2007-07-19T15:39:20Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (101) Transmit &amp;quot;S&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, the block transitions to state 010.&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2168</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2168"/>
		<updated>2007-07-19T15:38:55Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (011) Read Packet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  A query has no switches or masks on it, so a &amp;quot;Q&amp;quot; packet will be discarded from the CP2200/1 before continuing on.  A &amp;quot;P&amp;quot; packet has a large amount of data attached to it, so that is the only packet not discarded before continuing to the next state.  This allows later states to access the packet data, but also puts on those later states the responsibility for discarding the packet once finished with it.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, it discards the received packet and transitions to state 010.  ''Note: Received packet can be discarded anywhere in state 100 or 101.  The discard functionality may even be relocated to the end of state 011, as that state already interacts with the CP2200/1.''&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Ethernet_packets&amp;diff=2167</id>
		<title>Ethernet packets</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Ethernet_packets&amp;diff=2167"/>
		<updated>2007-07-19T15:36:41Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* &amp;quot;R&amp;quot; packet: reset */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This page deals with material under development.  Please be aware that the information here may change as development proceeds.'''&lt;br /&gt;
&lt;br /&gt;
This page details the packets we will send across our internal Ethernet to define the standards of communication between the digital boards and the controlling PC.  Both the FPGA designer and the PC software programmer will need to make reference to this page in order to coordinate their respective designs.&lt;br /&gt;
&lt;br /&gt;
== Open questions ==&lt;br /&gt;
&lt;br /&gt;
* How will the FPGA obtain the MAC address of the PC?  Can the cards broadcast, but filter out all packets not directly addressed to them?  How would PC get board MAC addresses then?  Print on PCB?&lt;br /&gt;
&lt;br /&gt;
== Structure of a packet ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Ethernet packet.PNG|thumb|150px|right|A typical Ethernet packet.]]&lt;br /&gt;
&lt;br /&gt;
=== Transmitting ===&lt;br /&gt;
&lt;br /&gt;
To the right is a diagram depicting the structure of an Ethernet packet.  On the left side is marked the blocks that must be defined by the FPGA to be passed to the CP2200/1.  The first 8 bytes (&amp;quot;Preamble and Start Frame Delimiter&amp;quot;) and last 4 bytes (&amp;quot;CRC&amp;quot;) will be generated by the CP2200/1, so the FPGA need not even be aware of them.  The first significant block is the 6-byte destination MAC address.  The FPGA will have to store this (internally or using the RAM supplied by the CP2200/1) and then insert it into the appropriate place.  The next block is the 6-byte source MAC address.  Each CP2200/1 comes with a factory-set unique MAC address stored in the last page of Flash memory that will be used as the source MAC address.  The next block is the 2-byte length block.  This is the number of bytes of data, which can be as small as 46 or as large as 1,500.  Then finally comes the data block, which must be padded to a minimum of 46 bytes but can not exceed 1,500 bytes.&lt;br /&gt;
&lt;br /&gt;
=== Receiving ===&lt;br /&gt;
&lt;br /&gt;
The CP2200/1 appears to give access to the entire 64-byte (minimum) packet, which would include everything on the above diagram except for the &amp;quot;Preamble and Start Frame Delimiter&amp;quot;.  The CP2200/2 can be programmed to filter out any packets not addressed to it.  However, it only verifies the first 5 bytes of the MAC address.  Checking the 6th byte and using the skip procedure is left to the FPGA.  For good packets the FPGA can strip away and ignore the first 14 bytes (it does not need the length field, as we define our own standard for the packets below, using the first data byte to specify the type of packet).  From there the FPGA can parse the data field according to the below specifications.&lt;br /&gt;
&lt;br /&gt;
== Our packets ==&lt;br /&gt;
&lt;br /&gt;
We will use six types of packets in our communications, paired into three &amp;quot;conversations&amp;quot; or &amp;quot;cycles&amp;quot;: a reset cycle, a query cycle, a programming cycle.  Each packet's data section will begin with a single-byte code to identify the packet type.  As a mnemonic, these bytes will use ASCII codes to represent a single-letter shorthand for each packet.&lt;br /&gt;
&lt;br /&gt;
=== The reset cycle ===&lt;br /&gt;
&lt;br /&gt;
The reset cycle is a conversation whose purpose is to reset the digital control board.  On each power-on, the various chips on the digital board need to be re-initialized.  This includes the Ethernet chip itself, so the reset functionality needs to be built into the FPGA logic by default and needs to execute on start-up with no external stimulus in order to obtain Ethernet control.  However it may also be necessary to instigate a reset externally for some reason.  This cycle allows the external PC to initiate a reset and will notify the PC when the system is fully initialized.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;R&amp;quot; packet: reset ====&lt;br /&gt;
&lt;br /&gt;
This is the packet sent from the PC to the card to initiate a reset process.  Two possible reset packet ideas can be considered:&lt;br /&gt;
* Full reset: This resets all chips on the board (except for the FPGA; that should reset only during a power-up) together.  This will contain no data.&lt;br /&gt;
* Selective reset: This will have flags to reset the Ethernet chip, the ADC, the temperature sensor, and the DAC.  Combinations of flags allow a selective reset of any combination of the four chips.  This will contain four flags which can be packaged into a single byte.&lt;br /&gt;
The first data byte will be an ASCII '''R''': 0x52, 0101 0010.  For a full-reset-only design, all remaining bytes in the packet will be padding that the FPGA can ignore.  For a selective-reset design, the second data byte will contain the four flags, and all bytes after that will be padding.  A selective-reset design allows a form of &amp;quot;Are you awake&amp;quot; query to the board: Send a reset packet with all reset flags turned off; the system will not reset any devices but will still respond with an &amp;quot;I&amp;quot; packet.  This may be an unnecessary feature, as the query cycle already acts as a more complex &amp;quot;Are you awake&amp;quot; query.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;I&amp;quot; packet: initialization complete ====&lt;br /&gt;
&lt;br /&gt;
This is the acknowledgment packet sent from the FPGA to the PC to state that the reset cycle has been completed and the digital board is ready to resume regular operations.  At this point all settings on the digital board have returned to their defaults (likely to mean all DAC channels set to zero).  There is no data associated with this packet, so the only significant byte is the first byte, an ASCII '''I''': 0x49, 0100 1001.&lt;br /&gt;
&lt;br /&gt;
=== The query cycle ===&lt;br /&gt;
&lt;br /&gt;
The query cycle is a conversation regarding the status of the digital board.  It polls the sensor devices and reports back their most recent data.  &lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;Q&amp;quot; packet: query ====&lt;br /&gt;
&lt;br /&gt;
This is the packet sent from the PC to the FPGA to request a status report.  This could be made selective (status of ADC only, status of temperature sensor only, or full status report).  However, as the size of an Ethernet packet is so large compared to the amount of data being requested, all data will be sent and the PC can use the data as it desires.  Thus there is no data attached to a query packet.  The first byte is an ASCII '''Q''': 0x51, 0101 0001.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;S&amp;quot; packet: status report ====&lt;br /&gt;
&lt;br /&gt;
This is the packet sent from the FPGA to the PC to report on the current status of the board.  The first byte of the packet will be an ASCII '''S''': 0x53, 0101 0011.  After that will come the status data.&lt;br /&gt;
* The first two bytes of data will be the temperature.  The temperature sensor returns 10 bits of data.  The first byte will contain six leading zeros, then the two MSB of data.  The second byte will contain the 8 LSB of data.  An alternate scheme would be to convert the 10-bit two's-complement data into 16-bit two's-complement data and return that in two bytes.&lt;br /&gt;
* The next 16 bytes of data will be the ADC channels.  The ADC returns 8 channels of 12 bits each.  The first byte for each channel will have four leading zeros, then the 4 MSB of the data.  The second byte for each channel will contain the 8 LSB of the data.  The channels will be reported from channel zero to channel seven.  An alternate scheme would be to convert the 12-bit two's-complement data into 16-bit two's-complement data and return that in two bytes each.&lt;br /&gt;
This totals 19 bytes: one of ASCII, two of temperature, sixteen of voltages.&lt;br /&gt;
&lt;br /&gt;
=== The programming cycle ===&lt;br /&gt;
&lt;br /&gt;
The programming cycle is a conversation intended to set the values of the DAC channels.  It sends programming data to the board and receives confirmation of the programming.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;P&amp;quot; packet: programming ====&lt;br /&gt;
&lt;br /&gt;
This is the packet sent from the PC to the FPGA to set new values to the DAC channels.  The first byte of the packet will be an ASCII '''P''': 0x50, 0101 0000.  The next four bytes (if all 32 channels are used; 3 if 24 channels, 2 bytes if 16 channels) together form a programming mask.  Any channel that is to be reprogrammed will have a 1 in the corresponding location, and any channel that is to be left alone will have a 0 in the corresponding location.  The MSB of the first byte will be channel 31 (or 23 or 15) and the LSB of the fourth (or third or second) byte will be channel 0.  Thus, if all 32 channels are to be used, but only channels 14 through 26 are to be programmed, the packet would contain:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
! First data byte&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
! Second data byte&lt;br /&gt;
| 1 || 1 || 1 || 1 || 1 || 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
! Third data byte&lt;br /&gt;
| 1 || 1 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
! Fourth data byte&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
Following this are 64 (or 48 or 32) bytes of programming data.  The first two bytes are for channel 31 (or 23 or 15) and the last two bytes are for channel 0.  Each channel has 14 bits, so the format is two leading zeros and 6 MSB of data is the first byte, then 8 LSB of data in the second byte.  All channels are present in the packet, but only those marked in the mask will be programmed; all other bytes will be ignored and can take on any value.  The total size of the data in a programming packet is:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! Number of channels&lt;br /&gt;
|    &lt;br /&gt;
! Data Bytes per Packet&lt;br /&gt;
|-&lt;br /&gt;
| 32 ||      || 69&lt;br /&gt;
|-&lt;br /&gt;
| 24 ||      || 52&lt;br /&gt;
|-&lt;br /&gt;
| 16 ||      || 35&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
Since the minimum number of data bytes in a packet is 46, the packet may need to be padded if only 16 channels are to be used.  Alternately the mask can be eliminated, forcing all channels of the DAC to be reprogrammed every programming cycle; however, having a mask allows a query of all DAC channels: set the mask to all zeros to reprogram nothing and the response will report back channel values according to the FPGA.&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;D&amp;quot; packet: DAC setup complete ====&lt;br /&gt;
&lt;br /&gt;
This is the packet sent from the FPGA to the PC to confirm that the DAC has been programmed to specifications.  The first byte of this packet is an ASCII '''D''': 0x44, 0100 0100.  The next 64 (or 48 or 32) bytes are the values of each DAC channel.  As before, the format is two leading zeros and 6 MSB of data in the first byte and 8 LSB of data in the second byte, channel 31 (or 23 or 15) first, channel 0 last.  This confirms to the PC that the data was programmed according to specification and helps synchronize the control board and the PC.  All channels are reported back, not just those that were reprogrammed during this conversation.  This will require that the FPGA (or the RAM in the Ethernet chip) store the values of the DAC channels, as the DAC has no interface to report back the value of a given channel.  The size of this packet will be 4 (or 3 or 2) bytes less than for the corresponding programming packet, to account for the programming mask.&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2166</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2166"/>
		<updated>2007-07-19T15:35:07Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (101) Transmit &amp;quot;S&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  &amp;quot;Q&amp;quot; and &amp;quot;P&amp;quot; packets simply transition to the next state, allowing the following states to access the rest of the packet.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This block compiles the status values into a single packet by loading them into the CP2200/1 in a defined order and format, including padding/converting any values that need it.  Once the packet has been sent, it discards the received packet and transitions to state 010.  ''Note: Received packet can be discarded anywhere in state 100 or 101.  The discard functionality may even be relocated to the end of state 011, as that state already interacts with the CP2200/1.''&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2165</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2165"/>
		<updated>2007-07-19T15:33:41Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (100) Poll Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  &amp;quot;Q&amp;quot; and &amp;quot;P&amp;quot; packets simply transition to the next state, allowing the following states to access the rest of the packet.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
This block will have at least two functional blocks: one to poll the temperature sensor and one to poll the ADC.  Its job is to update all status values from the status chips in preparation for transmission.  Once all status values have been updated it transitions to state 101.&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2164</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2164"/>
		<updated>2007-07-19T15:33:14Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (011) Read Packet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
Block 011 is the first block with switching between following states.  Its first task is to load the MAC data of the packet.  If filtering inside of the FPGA is required, this block is responsible for it.  The only MAC filtering likely to be needed is a check to see if the destination MAC address matches the MAC address of the CP2200/1, but the CP2200/1 should filter this itself (verify in the data sheet).  If the packet is bad, this block tells the CP2200/1 to skip the packet and returns to block 010.  The MAC filter would be the first substate.&lt;br /&gt;
&lt;br /&gt;
After MAC filtering comes the second substate (or the only substate if MAC filtering is found to be unnecessary).  This reads the first byte of the packet's data and uses it as a switch to determine the transition to the next state:&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellpadding=&amp;quot;4&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! ASCII&lt;br /&gt;
|    &lt;br /&gt;
! Next State&lt;br /&gt;
|-&lt;br /&gt;
| R ||      || 000&lt;br /&gt;
|-&lt;br /&gt;
| Q ||      || 100&lt;br /&gt;
|-&lt;br /&gt;
| P ||      || 110&lt;br /&gt;
|-&lt;br /&gt;
| other ||      || 010&lt;br /&gt;
|}&lt;br /&gt;
Anything other than the three defined packets is considered a bad packet and is discarded in the CP2200/1 before transitioning back to state 010.  An &amp;quot;R&amp;quot; packet obtains the reset mask from the second byte then discards the packet before transitioning to state 000.  State 000 assumes that the reset mask is held, so this output needs to be latched in place until the next time this block activates.  &amp;quot;Q&amp;quot; and &amp;quot;P&amp;quot; packets simply transition to the next state, allowing the following states to access the rest of the packet.&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2163</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2163"/>
		<updated>2007-07-19T15:30:38Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (010) Idle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
Block 010 continuously polls the interrupt registers on the CP2200/1 until the Receive FIFO Empty flag comes back as a zero.  On this condition it transitions to state 011.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2162</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2162"/>
		<updated>2007-07-19T15:29:52Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (001) Transmit &amp;quot;I&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
This is a simple state.  It loads to the CP2200/1 a packet containing an ASCII &amp;quot;I&amp;quot; in the first byte and padding (zeros) in all remaining bits.  The CP2200/1 may handle padding itself; this will have to be verified in the data sheet.  After the transmission is complete, the block writes a 010 to the state register.&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2161</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2161"/>
		<updated>2007-07-19T15:28:24Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (000) Reset Cycle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
Block 000 will have four functional blocks: one each for the DAC, ADC, and Ethernet controller, and one to coordinate their completion.  The temperature sensor lacks an external reset function; it self-initializes on startup.  The &amp;quot;R&amp;quot; packet will supply flags as to whether or not to enable the various blocks.  A power-on reset will default to resetting all components.  Using the enable flags like a mask on the done lines, the fourth functional block will update the state register.  For information on the reset procedures, see [[Reset and Initialization]].&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2159</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2159"/>
		<updated>2007-07-19T15:25:18Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== The eight states ==&lt;br /&gt;
&lt;br /&gt;
There are eight major states to the module.&lt;br /&gt;
&lt;br /&gt;
=== State list ===&lt;br /&gt;
&lt;br /&gt;
; (000) Reset Cycle&lt;br /&gt;
: The reset cycle resets the selected chips.  There are flags for resetting all 4 chips: DAC, ADC, temperature sensor, Ethernet controller.  This is the entry state from a power-on.  From this state, proceed unconditionally to 001.&lt;br /&gt;
; (001) Transmit &amp;quot;I&amp;quot;&lt;br /&gt;
: This state transmits an &amp;quot;I&amp;quot; packet to acknowledge that a reset occurred but the board is now prepared to accept new packets and function normally. From this state, proceed unconditionally to 010.&lt;br /&gt;
; (010) Idle&lt;br /&gt;
: This is the idle state where the state machine awaits a new packet's arrival.  If the Receive FIFO is empty, it loops back on itself and continues checking the FIFO.  If the FIFO is not empty, proceed to 011.&lt;br /&gt;
; (011) Read Packet&lt;br /&gt;
: This state accesses the first packet.  If packets need to be filtered by the FPGA, this state will filter and return to 010 on a bad packet.  The MAC data is discarded, as it is unimportant to the FPGA, and the first data byte is read.  This byte is used as a switch: an ASCII &amp;quot;R&amp;quot; loops to 000.  A &amp;quot;Q&amp;quot; proceeds to 100.  A &amp;quot;P&amp;quot; proceeds to 110.  Any other value is a bad packet and the state machine returns to 010.&lt;br /&gt;
; (100) Poll Status&lt;br /&gt;
: This state polls the status chips (the ADC and the temperature sensor) so that recent data is ready for transmission.&lt;br /&gt;
; (101) Transmit &amp;quot;S&amp;quot;&lt;br /&gt;
: This state packages and transmits an &amp;quot;S&amp;quot; packet over the Ethernet to report back the status of the board in response to a &amp;quot;Q&amp;quot; packet.&lt;br /&gt;
; (110) Program DAC&lt;br /&gt;
: This state programs the DAC with new values according to the mask and data in the &amp;quot;P&amp;quot; packet.&lt;br /&gt;
; (111) Transmit &amp;quot;D&amp;quot;&lt;br /&gt;
: This state packages and transmits a &amp;quot;D&amp;quot; packet over the Ethernet to report back the DAC voltages in response to a &amp;quot;P&amp;quot; packet.&lt;br /&gt;
&lt;br /&gt;
=== State interconnect ===&lt;br /&gt;
&lt;br /&gt;
These states will form the outline of the functional block diagram.  Within each state will be a smaller process or set of processes, possibly broken into substates.  Additionally we will have a central ''state'' register.  Each block reads the state value in the register and enables itself upon seeing its own value.  After completion of its function, a block will write a new value to the state register to enable the next block.&lt;br /&gt;
&lt;br /&gt;
=== State variable ===&lt;br /&gt;
&lt;br /&gt;
Based on the assignments of state values to the various states, certain interpretations of the state's bits arise.  They may or may not prove useful in coding the system.  They are given here in the case that they do become useful.&lt;br /&gt;
* S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 0: &amp;quot;Core cycle&amp;quot; that executes regularly and forms the spine of the state diagram.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 00: &amp;quot;Initialization cycle&amp;quot; that prepares the state diagram for normal functioning.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 01: &amp;quot;Standard cycle&amp;quot; that the state machine returns to most frequently to process appropriate switching to branches.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1: &amp;quot;Branch cycles&amp;quot; that execute selectively based on received packets.&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 10: &amp;quot;Query cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
*** S&amp;lt;sub&amp;gt;2:1&amp;lt;/sub&amp;gt; = 11: &amp;quot;Programming cycle&amp;quot; as described in the page on [[Ethernet packets]].&lt;br /&gt;
* S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;:&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 0: &amp;quot;Setup state&amp;quot; to prepare internal workings for a communication.&lt;br /&gt;
** S&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; = 1: &amp;quot;Transfer state&amp;quot; to communicate with the external PC.&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2158</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2158"/>
		<updated>2007-07-19T15:22:21Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
* '''state register'''&lt;br /&gt;
** A three-bit register to store the current state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset to zero the register (puts system into reset state)&lt;br /&gt;
*** ''En'': write enable&lt;br /&gt;
*** ''D'': three-bit data-in bus&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Q'': three-bit data-out bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2157</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2157"/>
		<updated>2007-07-19T15:19:24Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (000) Reset Cycle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state register as an enable&lt;br /&gt;
*** ''New_St'': new state to be written to the state register; goes to 001 while ''Done'' is high&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2155</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2155"/>
		<updated>2007-07-19T15:03:03Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state counter as an enable (thereby incrementing the ''State'' to 001)&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''TxRx_A'': 8-bit address from transceiver&lt;br /&gt;
* ''TxRx_D'': 8-bit data from transceiver&lt;br /&gt;
* ''TxRx_Done'': pulse from transceiver to signal transfer complete&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not ''St(2)'' and ''St(1)'' and not ''St(0)''&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''Fetcher'''&lt;br /&gt;
** Reads register 0x76 (INT0RD) by sending a read request to the transceiver&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''F_Go'': pulse to start request, ''F_Go'' &amp;lt;= ''Go'' or ''Loop''&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''TxRx_Go'': ''Go'' line on transceiver&lt;br /&gt;
*** ''TxRx_R/W'': ''R/W'' line on transceiver, tied high (read)&lt;br /&gt;
*** ''TxRx_A'': ''A_in'' bus on transceiver, tied to 0x76 (0111 0110)&lt;br /&gt;
**** Note: ''D_in'' on transceiver is not used; assume this line defaults to zero&lt;br /&gt;
* '''Looper'''&lt;br /&gt;
** Switch to determine if this state should loop on itself or continue to the next state.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''S_En'': state enable&lt;br /&gt;
*** ''TxRx_Done'': ''Done'' pulse from transceiver&lt;br /&gt;
*** ''TxRx_Data'': ''D_out'' bus from transceiver&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Loop'': pulse to repeat fetch cycle; ''Loop'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and ''TxRx_Data(6)''&lt;br /&gt;
*** ''Done'': pulse to finish state; connects to state counter as an enable in order to increment the state to 011; ''Done'' &amp;lt;= ''S_En'' and ''TxRx_Done'' and not ''TxRx_Data(6)''&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2154</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2154"/>
		<updated>2007-07-19T14:41:03Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state counter as an enable (thereby incrementing the ''State'' to 001)&lt;br /&gt;
&lt;br /&gt;
=== (001) Transmit &amp;quot;I&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (010) Idle ===&lt;br /&gt;
&lt;br /&gt;
=== (011) Read Packet ===&lt;br /&gt;
&lt;br /&gt;
=== (100) Poll Status ===&lt;br /&gt;
&lt;br /&gt;
=== (101) Transmit &amp;quot;S&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
=== (110) Program DAC ===&lt;br /&gt;
&lt;br /&gt;
=== (111) Transmit &amp;quot;D&amp;quot; ===&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2153</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2153"/>
		<updated>2007-07-19T14:36:03Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (000) Reset Cycle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''Clk'': clock&lt;br /&gt;
* ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state counter as an enable (thereby incrementing the ''State'' to 001)&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2152</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2152"/>
		<updated>2007-07-19T14:32:17Z</updated>

		<summary type="html">&lt;p&gt;Krueger: /* (000) Reset Cycle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St(2)'' or ''St(1)'' or ''St(0)'')&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state counter as an enable (thereby incrementing the ''State'' to 001)&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
	<entry>
		<id>https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2151</id>
		<title>Programming the Ethernet controller</title>
		<link rel="alternate" type="text/html" href="https://zeus.phys.uconn.edu/wiki/index.php?title=Programming_the_Ethernet_controller&amp;diff=2151"/>
		<updated>2007-07-19T14:27:57Z</updated>

		<summary type="html">&lt;p&gt;Krueger: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Interface ==&lt;br /&gt;
&lt;br /&gt;
:''See also: [[Ethernet packets]]''&lt;br /&gt;
:''See also: [[Ethernet state diagram]]''&lt;br /&gt;
&lt;br /&gt;
== Emulator ==&lt;br /&gt;
&lt;br /&gt;
== Controller ==&lt;br /&gt;
&lt;br /&gt;
* '''transceiver'''&lt;br /&gt;
** This block provides a level of abstraction between the precise CP2200/1 interface and a generalized interface seen by the internal blocks of the FPGA.  It takes information on the next transfer to carry out and returns information on the last transfer completed.  It has a pulse signal to begin a transfer and a pulse signal to notify of a completed transfer.  This eliminates a need for the internal workings of the FPGA to be aware of the timing of the interface; it simply begins a transfer and waits for notification of the transfer's completion.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''CLK'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''Go'': pulse to begin a transmission&lt;br /&gt;
*** ''R/W_in'': read/write toggle: active-high read, active-low write&lt;br /&gt;
*** ''A_in'': 8-bit bus for address to read to/write from&lt;br /&gt;
*** ''D_in'': 8-bit bus for data to write; ignored during a read&lt;br /&gt;
** outputs to internals&lt;br /&gt;
*** ''Done'': pulse to signal completion of a transmission&lt;br /&gt;
*** ''R/W_out'': read/write flag: active-high read, active-low write&lt;br /&gt;
*** ''A_out'': 8-bit bus for address of last read/write&lt;br /&gt;
*** ''D_out'': 8-bit bus for data of last read; internal systems should ignore for a write&lt;br /&gt;
** outputs to CP2200/1&lt;br /&gt;
*** ''/CS'': active-low chip select&lt;br /&gt;
*** ''MotEn'': Motorola/Intel format toggle: active-high Motorola, active-low Intel&lt;br /&gt;
*** ''MuxEn'': Multiplexed flag; not used for CP2201&lt;br /&gt;
*** ''ALE'': ALE strobe&lt;br /&gt;
*** ''/Wr'': Active-low write flag&lt;br /&gt;
*** ''/Rd'': Active-low read flag&lt;br /&gt;
** inouts&lt;br /&gt;
*** ''AD'': 8-bit address and data bus&lt;br /&gt;
&lt;br /&gt;
=== (000) Reset Cycle ===&lt;br /&gt;
&lt;br /&gt;
inputs&lt;br /&gt;
* ''State'': 3-bit state value&lt;br /&gt;
* ''D_En'': DAC enable, assume held high/low by previous block&lt;br /&gt;
* ''A_En'': ADC enable, assume held high/low by previous block&lt;br /&gt;
* ''E_En'': Ethernet enable, assume held high/low by previous block&lt;br /&gt;
&lt;br /&gt;
internal signals&lt;br /&gt;
* ''S_En'': state enable, ''S_En'' &amp;lt;= not (''St''(2) or ''St''(1) or ''St''(0))&lt;br /&gt;
* ''Go'': when ''S_En'' goes high ''Go'' pulses for one cycle&lt;br /&gt;
* ''D_Go'': DAC reset go pulse, ''D_Go'' &amp;lt;= ''Go'' and ''D_En''&lt;br /&gt;
* ''A_Go'': ADC reset go pulse, ''A_Go'' &amp;lt;= ''Go'' and ''A_En''&lt;br /&gt;
* ''E_Go'': Ethernet reset go pulse, ''E_Go'' &amp;lt;= ''Go'' and ''E_En''&lt;br /&gt;
&lt;br /&gt;
blocks&lt;br /&gt;
* '''DAC Reset'''&lt;br /&gt;
** Resets and initializes the DAC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All DAC reset/initialization control lines -&lt;br /&gt;
*** ''D_Done'': goes high when reset/initialization process is complete, falls on ''D_Go'' pulse&lt;br /&gt;
* '''ADC Reset'''&lt;br /&gt;
** Resets and initializes the ADC.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''A_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All ADC reset/initialization control lines -&lt;br /&gt;
*** ''A_Done'': goes high when reset/initialization process is complete, falls on ''A_Go'' pulse&lt;br /&gt;
* '''Ethernet Reset'''&lt;br /&gt;
** Resets and initializes the Ethernet controller.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''E_Go'': go pulse to begin reset/initialization process&lt;br /&gt;
** outputs&lt;br /&gt;
*** - All Ethernet reset/initialization control lines -&lt;br /&gt;
*** ''E_Done'': goes high when reset/initialization process is complete, falls on ''E_Go'' pulse&lt;br /&gt;
* '''Coordinator'''&lt;br /&gt;
** Coordinates the completion of each reset cycle and notifies other blocks that the reset process is complete.&lt;br /&gt;
** inputs&lt;br /&gt;
*** ''Clk'': clock&lt;br /&gt;
*** ''/Rst'': asynchronous, active-low reset&lt;br /&gt;
*** ''D_En'': high when DAC is to be reset&lt;br /&gt;
*** ''D_Done'': high when DAC is done resetting&lt;br /&gt;
*** ''A_En'': high when ADC is to be reset&lt;br /&gt;
*** ''A_Done'': high when ADC is done resetting&lt;br /&gt;
*** ''E_En'': high when Ethernet controller is to be reset&lt;br /&gt;
*** ''E_Done'': high when Ethernet controller is done resetting&lt;br /&gt;
** internal signals&lt;br /&gt;
*** ''Flag'' &amp;lt;= (''D_Done'' or not ''D_En'') and (''A_Done'' or not ''A_En'') and (''E_Done'' or not ''E_En'')&lt;br /&gt;
** outputs&lt;br /&gt;
*** ''Done'': when ''Flag'' goes high, ''Done'' pulses for one cycle; connects to state counter as an enable (thereby incrementing the ''State'' to 001)&lt;/div&gt;</summary>
		<author><name>Krueger</name></author>
	</entry>
</feed>