OpenCores
URL https://opencores.org/ocsvn/aoocs/aoocs/trunk

Subversion Repositories aoocs

[/] [aoocs/] [trunk/] [doc/] [doxygen/] [html/] [cia8520_8v_source.html] - Rev 2

Compare with Previous | Blame | View Log

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>aoOCS: cia8520.v Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Design&#160;Unit&#160;List</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>cia8520.v</h1>  </div>
</div>
<div class="contents">
<a href="cia8520_8v.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001  <span class="keyword">/* </span>
<a name="l00002"></a>00002 <span class="keyword">  Copyright 2010, Aleksander Osman, alfik@poczta.fm. All rights reserved.</span>
<a name="l00003"></a>00003 <span class="keyword"> </span>
<a name="l00004"></a>00004 <span class="keyword">  Redistribution and use in source and binary forms, with or without modification, are</span>
<a name="l00005"></a>00005 <span class="keyword">  permitted provided that the following conditions are met:</span>
<a name="l00006"></a>00006 <span class="keyword"> </span>
<a name="l00007"></a>00007 <span class="keyword">   1. Redistributions of source code must retain the above copyright notice, this list of</span>
<a name="l00008"></a>00008 <span class="keyword">      conditions and the following disclaimer.</span>
<a name="l00009"></a>00009 <span class="keyword"> </span>
<a name="l00010"></a>00010 <span class="keyword">   2. Redistributions in binary form must reproduce the above copyright notice, this list</span>
<a name="l00011"></a>00011 <span class="keyword">      of conditions and the following disclaimer in the documentation and/or other materials</span>
<a name="l00012"></a>00012 <span class="keyword">      provided with the distribution.</span>
<a name="l00013"></a>00013 <span class="keyword"> </span>
<a name="l00014"></a>00014 <span class="keyword">  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS&#39;&#39; AND ANY EXPRESS OR IMPLIED</span>
<a name="l00015"></a>00015 <span class="keyword">  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND</span>
<a name="l00016"></a>00016 <span class="keyword">  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR</span>
<a name="l00017"></a>00017 <span class="keyword">  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR</span>
<a name="l00018"></a>00018 <span class="keyword">  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR</span>
<a name="l00019"></a>00019 <span class="keyword">  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON</span>
<a name="l00020"></a>00020 <span class="keyword">  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
<a name="l00021"></a>00021 <span class="keyword">  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF</span>
<a name="l00022"></a>00022 <span class="keyword">  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00023"></a>00023 <span class="keyword"> */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="keyword">/*! \file</span>
<a name="l00026"></a>00026 <span class="keyword">  \brief Commodore 8520 Complex Interface Adapter implementation.</span>
<a name="l00027"></a>00027 <span class="keyword"> */</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="keyword">/*! \brief \copybrief cia8520.v</span>
<a name="l00030"></a>00030 <span class="keyword">*/</span>
<a name="l00031"></a><a class="code" href="classcia8520.html">00031</a> <span class="vhdlkeyword">module</span> <a class="code" href="classcia8520.html">cia8520</a>(
<a name="l00032"></a>00032     <span class="keyword">//% \name Clock and reset
</span>
<a name="l00033"></a>00033     <span class="keyword">//% @{</span>
<a name="l00034"></a><a class="code" href="classcia8520.html#af7454ea20899e888f30007136ba4fde9">00034</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#af7454ea20899e888f30007136ba4fde9">CLK_I</a>,
<a name="l00035"></a><a class="code" href="classcia8520.html#ae3053a011caf90fa83f79e9f3edc428d">00035</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#ae3053a011caf90fa83f79e9f3edc428d">reset_n</a>,
<a name="l00036"></a>00036     <span class="keyword">//% @}</span>
<a name="l00037"></a>00037     
<a name="l00038"></a>00038     <span class="keyword">//% \name WISHBONE slave
</span>
<a name="l00039"></a>00039     <span class="keyword">//% @{</span>
<a name="l00040"></a><a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">00040</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a>,
<a name="l00041"></a><a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">00041</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a>,
<a name="l00042"></a><a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">00042</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a>,
<a name="l00043"></a><a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">00043</a>     <span class="vhdlkeyword">input</span> [<span class="vhdllogic">3</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a>,
<a name="l00044"></a><a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">00044</a>     <span class="vhdlkeyword">input</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>,
<a name="l00045"></a><a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">00045</a>     <span class="vhdlkeyword">output</span> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a>,
<a name="l00046"></a><a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">00046</a>     <span class="vhdlkeyword">output</span> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a>,
<a name="l00047"></a>00047     <span class="keyword">//% @}</span>
<a name="l00048"></a>00048     
<a name="l00049"></a>00049     <span class="keyword">//% \name Internal OCS ports
</span>
<a name="l00050"></a>00050     <span class="keyword">//% @{</span>
<a name="l00051"></a><a class="code" href="classcia8520.html#a46b0acf74c4cd2ce0fbd3defc5386136">00051</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#a46b0acf74c4cd2ce0fbd3defc5386136">pulse_709379_hz</a>,
<a name="l00052"></a>00052     <span class="keyword">//% @}</span>
<a name="l00053"></a>00053     
<a name="l00054"></a>00054     <span class="keyword">//% \name 8520 synchronous interface
</span>
<a name="l00055"></a>00055     <span class="keyword">//% @{</span>
<a name="l00056"></a><a class="code" href="classcia8520.html#a6170dfb9309559053d3a796539b0836e">00056</a>     <span class="vhdlkeyword">output</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a6170dfb9309559053d3a796539b0836e">pa_o</a>,
<a name="l00057"></a><a class="code" href="classcia8520.html#a13cdeb43c9a7752f29f22b0e91b33017">00057</a>     <span class="vhdlkeyword">output</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a13cdeb43c9a7752f29f22b0e91b33017">pb_o</a>,
<a name="l00058"></a><a class="code" href="classcia8520.html#aaa572548e346e473e4bd0d2a2b81e31b">00058</a>     <span class="vhdlkeyword">input</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#aaa572548e346e473e4bd0d2a2b81e31b">pa_i</a>,
<a name="l00059"></a><a class="code" href="classcia8520.html#a24bf9b866e68ca32fc5594e5b7ea37dd">00059</a>     <span class="vhdlkeyword">input</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a24bf9b866e68ca32fc5594e5b7ea37dd">pb_i</a>,
<a name="l00060"></a>00060     
<a name="l00061"></a><a class="code" href="classcia8520.html#a8f14aac8ad64c383dda57b5cfa8d9576">00061</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#a8f14aac8ad64c383dda57b5cfa8d9576">flag_n</a>,
<a name="l00062"></a><a class="code" href="classcia8520.html#af4bd9d1e2af389f8e8129c43c542345a">00062</a>     <span class="vhdlkeyword">output</span> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#af4bd9d1e2af389f8e8129c43c542345a">pc_n</a>,
<a name="l00063"></a><a class="code" href="classcia8520.html#a2122ea742c7126d13cc5bb9e9d4e95db">00063</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#a2122ea742c7126d13cc5bb9e9d4e95db">tod</a>,
<a name="l00064"></a><a class="code" href="classcia8520.html#aae48637f69b17be5abc54ad39726f86e">00064</a>     <span class="vhdlkeyword">output</span> <a class="code" href="classcia8520.html#aae48637f69b17be5abc54ad39726f86e">irq_n</a>,
<a name="l00065"></a>00065     
<a name="l00066"></a><a class="code" href="classcia8520.html#a0d394218047f203560d75a3cd380ac3e">00066</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#a0d394218047f203560d75a3cd380ac3e">sp_i</a>,
<a name="l00067"></a><a class="code" href="classcia8520.html#a4f5d392cf19a60f0a9e24b019b2f9c70">00067</a>     <span class="vhdlkeyword">output</span> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a4f5d392cf19a60f0a9e24b019b2f9c70">sp_o</a>,
<a name="l00068"></a><a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">00068</a>     <span class="vhdlkeyword">input</span> <a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">cnt_i</a>,
<a name="l00069"></a><a class="code" href="classcia8520.html#a3ac9f49f562604b082a4023ec0add13d">00069</a>     <span class="vhdlkeyword">output</span> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a3ac9f49f562604b082a4023ec0add13d">cnt_o</a>
<a name="l00070"></a>00070     <span class="keyword">//% @}</span>
<a name="l00071"></a>00071 );
<a name="l00072"></a>00072 
<a name="l00073"></a><a class="code" href="classcia8520.html#aea2105909da941728fed899d74afeff0">00073</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#aea2105909da941728fed899d74afeff0">pa_o_reg</a>;
<a name="l00074"></a>00074 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a6170dfb9309559053d3a796539b0836e">pa_o</a> = (<a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a> &amp; <a class="code" href="classcia8520.html#aea2105909da941728fed899d74afeff0">pa_o_reg</a>) | (~<a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a> &amp; <a class="code" href="classcia8520.html#aaa572548e346e473e4bd0d2a2b81e31b">pa_i</a>);
<a name="l00075"></a><a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">00075</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>;
<a name="l00076"></a>00076 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a13cdeb43c9a7752f29f22b0e91b33017">pb_o</a> = (<a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a> &amp; <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>) | (~<a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a> &amp; <a class="code" href="classcia8520.html#a24bf9b866e68ca32fc5594e5b7ea37dd">pb_i</a>);
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#aae48637f69b17be5abc54ad39726f86e">irq_n</a> = ~<a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">5</span>];
<a name="l00079"></a>00079 
<a name="l00080"></a><a class="code" href="classcia8520.html#af360efc39c1560425a58f4344ed90e89">00080</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#af360efc39c1560425a58f4344ed90e89">last_cnt_i</a>;
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="keyword">// 0 = input, 1 = output</span>
<a name="l00083"></a><a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">00083</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a>;
<a name="l00084"></a><a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">00084</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a>;
<a name="l00085"></a>00085 
<a name="l00086"></a><a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">00086</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">15</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">timera_latch</a>;
<a name="l00087"></a><a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">00087</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">15</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">timerb_latch</a>;
<a name="l00088"></a><a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">00088</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>;
<a name="l00089"></a><a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">00089</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">6</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>;
<a name="l00090"></a><a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">00090</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">23</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>;
<a name="l00091"></a><a class="code" href="classcia8520.html#ab6c6b9ff872e5af9ecf775df56d03f83">00091</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">23</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ab6c6b9ff872e5af9ecf775df56d03f83">tod_latch</a>;
<a name="l00092"></a><a class="code" href="classcia8520.html#a3eb6a5baa87f3a197a5cb1a9a3699a07">00092</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a3eb6a5baa87f3a197a5cb1a9a3699a07">tod_write_stop</a>;
<a name="l00093"></a><a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">00093</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">tod_read_latch</a>;
<a name="l00094"></a><a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">00094</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">23</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">tod_alarm</a>;
<a name="l00095"></a>00095 
<a name="l00096"></a><a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">00096</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a>;
<a name="l00097"></a><a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">00097</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a>;
<a name="l00098"></a><a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">00098</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a>;
<a name="l00099"></a><a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">00099</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a>;
<a name="l00100"></a><a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">00100</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">4</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a>;
<a name="l00101"></a>00101 
<a name="l00102"></a><a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">00102</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a>;
<a name="l00103"></a><a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">00103</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>;
<a name="l00104"></a>00104 
<a name="l00105"></a><a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">00105</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a>;
<a name="l00106"></a>00106 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> = (<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d13</span>) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <span class="keyword">// from datasheet:</span>
<a name="l00109"></a>00109 <span class="keyword">// write high &amp;&amp; one-shot &amp;&amp; stopped(?) ----&gt; timer &lt;= latch; initiate counting regardless start; start &lt;= 1&#39;b1(?)</span>
<a name="l00110"></a>00110 <span class="keyword">// write high &amp;&amp; stopped ----&gt; timer &lt;= latch;</span>
<a name="l00111"></a>00111 <span class="keyword">// write high &amp;&amp; running ----&gt; latch</span>
<a name="l00112"></a>00112 
<a name="l00113"></a>00113 <span class="keyword">// Timer A</span>
<a name="l00114"></a><a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">00114</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">15</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a>;
<a name="l00115"></a><a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">00115</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a>;
<a name="l00116"></a>00116 
<a name="l00117"></a><a class="code" href="classcia8520.html#abedeaa7155bf5185420b5dd4606982bc">00117</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#abedeaa7155bf5185420b5dd4606982bc">timera_force_load</a>;
<a name="l00118"></a>00118 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#abedeaa7155bf5185420b5dd4606982bc">timera_force_load</a> = 
<a name="l00119"></a>00119     (<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d14</span> &amp;&amp; <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">4</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> == <span class="vhdllogic">1&#39;b1</span>) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00120"></a>00120 
<a name="l00121"></a><a class="code" href="classcia8520.html#a8fa6fd5e096036071cf0899aed4da3d3">00121</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#a8fa6fd5e096036071cf0899aed4da3d3">timera_loadhigh_when_stopped</a>;
<a name="l00122"></a>00122 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a8fa6fd5e096036071cf0899aed4da3d3">timera_loadhigh_when_stopped</a> = 
<a name="l00123"></a>00123     (<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d5</span> &amp;&amp; <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> == <span class="vhdllogic">1&#39;b1</span>) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00124"></a>00124 
<a name="l00125"></a><a class="code" href="classcia8520.html#af390e1e0016a3461c18b6912b7d76439">00125</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#af390e1e0016a3461c18b6912b7d76439">timera_tick</a>;
<a name="l00126"></a>00126 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#af390e1e0016a3461c18b6912b7d76439">timera_tick</a> =
<a name="l00127"></a>00127     (<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp;
<a name="l00128"></a>00128         ( 
<a name="l00129"></a>00129             (<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">4</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a46b0acf74c4cd2ce0fbd3defc5386136">pulse_709379_hz</a> == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00130"></a>00130             (<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">4</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#af360efc39c1560425a58f4344ed90e89">last_cnt_i</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">cnt_i</a> == <span class="vhdllogic">1&#39;b1</span>)
<a name="l00131"></a>00131         )
<a name="l00132"></a>00132     ) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134 <span class="keyword">// Timer B</span>
<a name="l00135"></a><a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">00135</a> <span class="vhdlkeyword">reg</span> [<span class="vhdllogic">15</span>:<span class="vhdllogic">0</span>] <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a>;
<a name="l00136"></a><a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">00136</a> <span class="vhdlkeyword">reg</span> <a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a>;
<a name="l00137"></a>00137 
<a name="l00138"></a><a class="code" href="classcia8520.html#a1babb675cbb1c4dcb6727ff1f200f664">00138</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#a1babb675cbb1c4dcb6727ff1f200f664">timerb_force_load</a>;
<a name="l00139"></a>00139 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a1babb675cbb1c4dcb6727ff1f200f664">timerb_force_load</a> = 
<a name="l00140"></a>00140     (<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d15</span> &amp;&amp; <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">4</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> == <span class="vhdllogic">1&#39;b1</span>) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00141"></a>00141 
<a name="l00142"></a><a class="code" href="classcia8520.html#a90ac5696f1dc1b4f2efa145ec93b1abf">00142</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#a90ac5696f1dc1b4f2efa145ec93b1abf">timerb_loadhigh_when_stopped</a>;
<a name="l00143"></a>00143 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a90ac5696f1dc1b4f2efa145ec93b1abf">timerb_loadhigh_when_stopped</a> = 
<a name="l00144"></a>00144     (<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d7</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> == <span class="vhdllogic">1&#39;b1</span>) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00145"></a>00145 
<a name="l00146"></a><a class="code" href="classcia8520.html#a1f811c521a8b8c0598ba7819910b06f0">00146</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#a1f811c521a8b8c0598ba7819910b06f0">timerb_tick</a>;
<a name="l00147"></a>00147 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a1f811c521a8b8c0598ba7819910b06f0">timerb_tick</a> = 
<a name="l00148"></a>00148     (<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp;
<a name="l00149"></a>00149         (
<a name="l00150"></a>00150             (<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">4</span>] == <span class="vhdllogic">2&#39;b00</span> &amp;&amp; <a class="code" href="classcia8520.html#a46b0acf74c4cd2ce0fbd3defc5386136">pulse_709379_hz</a> == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00151"></a>00151             (<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">4</span>] == <span class="vhdllogic">2&#39;b01</span> &amp;&amp; <a class="code" href="classcia8520.html#af360efc39c1560425a58f4344ed90e89">last_cnt_i</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">cnt_i</a> == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00152"></a>00152             (<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">4</span>] == <span class="vhdllogic">2&#39;b10</span> &amp;&amp; <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00153"></a>00153             (<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">4</span>] == <span class="vhdllogic">2&#39;b11</span> &amp;&amp; <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">cnt_i</a> == <span class="vhdllogic">1&#39;b1</span>)             
<a name="l00154"></a>00154         ) 
<a name="l00155"></a>00155     ) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00156"></a>00156 
<a name="l00157"></a><a class="code" href="classcia8520.html#a6a3c75ee0ddd8106ef64b3854c049c94">00157</a> <span class="vhdlkeyword">wire</span> <a class="code" href="classcia8520.html#a6a3c75ee0ddd8106ef64b3854c049c94">alarm</a>;
<a name="l00158"></a>00158 <span class="vhdlkeyword">assign</span> <a class="code" href="classcia8520.html#a6a3c75ee0ddd8106ef64b3854c049c94">alarm</a> = (<a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a> == <a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">tod_alarm</a>);
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="classcia8520.html#a7c5ddb750df70240a01268359b39bcff">00160</a> <span class="vhdlkeyword">always</span> @(<span class="vhdlkeyword">posedge</span> <a class="code" href="classcia8520.html#af7454ea20899e888f30007136ba4fde9">CLK_I</a> <span class="vhdlkeyword">or</span> <span class="vhdlkeyword">negedge</span> <a class="code" href="classcia8520.html#ae3053a011caf90fa83f79e9f3edc428d">reset_n</a>) <span class="vhdlkeyword">begin</span>
<a name="l00161"></a>00161     <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ae3053a011caf90fa83f79e9f3edc428d">reset_n</a> == <span class="vhdllogic">1&#39;b0</span>) <span class="vhdlkeyword">begin</span>
<a name="l00162"></a>00162         <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00163"></a>00163         <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00164"></a>00164         
<a name="l00165"></a>00165         <a class="code" href="classcia8520.html#aea2105909da941728fed899d74afeff0">pa_o_reg</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00166"></a>00166         <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00167"></a>00167         <a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00168"></a>00168         <a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00169"></a>00169         
<a name="l00170"></a>00170         <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a> &lt;= <span class="vhdllogic">16&#39;d0</span>;
<a name="l00171"></a>00171         <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00172"></a>00172         <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a> &lt;= <span class="vhdllogic">16&#39;d0</span>;
<a name="l00173"></a>00173         <a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00174"></a>00174         
<a name="l00175"></a>00175         <a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">timera_latch</a> &lt;= <span class="vhdllogic">16&#39;hFFFF</span>;
<a name="l00176"></a>00176         <a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">timerb_latch</a> &lt;= <span class="vhdllogic">16&#39;hFFFF</span>;
<a name="l00177"></a>00177         <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a> &lt;= <span class="vhdllogic">6&#39;d0</span>;
<a name="l00178"></a>00178         <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a> &lt;= <span class="vhdllogic">7&#39;d0</span>;
<a name="l00179"></a>00179         
<a name="l00180"></a>00180         <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a> &lt;= <span class="vhdllogic">24&#39;d0</span>;
<a name="l00181"></a>00181         <a class="code" href="classcia8520.html#ab6c6b9ff872e5af9ecf775df56d03f83">tod_latch</a> &lt;= <span class="vhdllogic">24&#39;d0</span>;
<a name="l00182"></a>00182         <a class="code" href="classcia8520.html#a3eb6a5baa87f3a197a5cb1a9a3699a07">tod_write_stop</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00183"></a>00183         <a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">tod_read_latch</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00184"></a>00184         <a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">tod_alarm</a> &lt;= <span class="vhdllogic">24&#39;d0</span>;
<a name="l00185"></a>00185         
<a name="l00186"></a>00186         <a class="code" href="classcia8520.html#af4bd9d1e2af389f8e8129c43c542345a">pc_n</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00187"></a>00187         
<a name="l00188"></a>00188         <a class="code" href="classcia8520.html#a4f5d392cf19a60f0a9e24b019b2f9c70">sp_o</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00189"></a>00189         <a class="code" href="classcia8520.html#a3ac9f49f562604b082a4023ec0add13d">cnt_o</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00190"></a>00190         <a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00191"></a>00191         <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00192"></a>00192         <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00193"></a>00193         <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00194"></a>00194         <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d0</span>;
<a name="l00195"></a>00195         
<a name="l00196"></a>00196         <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a> &lt;= <span class="vhdllogic">6&#39;d0</span>;
<a name="l00197"></a>00197         <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a> &lt;= <span class="vhdllogic">6&#39;d0</span>;
<a name="l00198"></a>00198     <span class="vhdlkeyword">end</span>
<a name="l00199"></a>00199     <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">begin</span>
<a name="l00200"></a>00200         <a class="code" href="classcia8520.html#af360efc39c1560425a58f4344ed90e89">last_cnt_i</a> &lt;= <a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">cnt_i</a>;
<a name="l00201"></a>00201     
<a name="l00202"></a>00202         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> == <span class="vhdllogic">1&#39;b1</span>)                           <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00203"></a>00203         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span>)     <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00204"></a>00204         
<a name="l00205"></a>00205         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a2122ea742c7126d13cc5bb9e9d4e95db">tod</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a3eb6a5baa87f3a197a5cb1a9a3699a07">tod_write_stop</a> == <span class="vhdllogic">1&#39;b0</span>) <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a> &lt;= <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a> + <span class="vhdllogic">24&#39;d1</span>;
<a name="l00206"></a>00206         
<a name="l00207"></a>00207         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#af4bd9d1e2af389f8e8129c43c542345a">pc_n</a> == <span class="vhdllogic">1&#39;b0</span>) <a class="code" href="classcia8520.html#af4bd9d1e2af389f8e8129c43c542345a">pc_n</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00208"></a>00208         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d1</span> &amp;&amp; <a class="code" href="classcia8520.html#a3e103bae86a70c174dc2f5ebf63438a4">ACK_O</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#af4bd9d1e2af389f8e8129c43c542345a">pc_n</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00209"></a>00209         
<a name="l00210"></a>00210         <span class="keyword">// interrupt data</span>
<a name="l00211"></a>00211         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>)  <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">0</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;        <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">0</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00212"></a>00212         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> == <span class="vhdllogic">1&#39;b1</span>)  <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">1</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;        <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">1</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00213"></a>00213         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a6a3c75ee0ddd8106ef64b3854c049c94">alarm</a> == <span class="vhdllogic">1&#39;b1</span>)       <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">2</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;        <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">2</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00214"></a>00214         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> == <span class="vhdllogic">1&#39;b1</span>)  <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">3</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;        <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">3</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00215"></a>00215         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a8f14aac8ad64c383dda57b5cfa8d9576">flag_n</a> == <span class="vhdllogic">1&#39;b0</span>)      <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">4</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;        <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">4</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00216"></a>00216         
<a name="l00217"></a>00217         <span class="vhdlkeyword">if</span>( (<a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>     &amp;&amp; <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00218"></a>00218             (<a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> == <span class="vhdllogic">1&#39;b1</span>     &amp;&amp; <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00219"></a>00219             (<a class="code" href="classcia8520.html#a6a3c75ee0ddd8106ef64b3854c049c94">alarm</a> == <span class="vhdllogic">1&#39;b1</span>          &amp;&amp; <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a>[<span class="vhdllogic">2</span>] == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00220"></a>00220             (<a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> == <span class="vhdllogic">1&#39;b1</span>     &amp;&amp; <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a>[<span class="vhdllogic">3</span>] == <span class="vhdllogic">1&#39;b1</span>) ||
<a name="l00221"></a>00221             (<a class="code" href="classcia8520.html#a8f14aac8ad64c383dda57b5cfa8d9576">flag_n</a> == <span class="vhdllogic">1&#39;b0</span>         &amp;&amp; <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a>[<span class="vhdllogic">4</span>] == <span class="vhdllogic">1&#39;b1</span>)
<a name="l00222"></a>00222         ) <span class="vhdlkeyword">begin</span>
<a name="l00223"></a>00223             <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">5</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00224"></a>00224         <span class="vhdlkeyword">end</span>
<a name="l00225"></a>00225         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#afc9338335b96773f2049399a04255529">icr_data_read</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">5</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00226"></a>00226         
<a name="l00227"></a>00227         
<a name="l00228"></a>00228         <span class="keyword">//******** SERIAL</span>
<a name="l00229"></a>00229         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00230"></a>00230         
<a name="l00231"></a>00231         <span class="keyword">// serial output</span>
<a name="l00232"></a>00232         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">5</span>] == <span class="vhdllogic">1&#39;b1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00233"></a>00233             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> == <span class="vhdllogic">5&#39;d0</span> &amp;&amp; <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> == <span class="vhdllogic">1&#39;b1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00234"></a>00234                 <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a> &lt;= <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a>;
<a name="l00235"></a>00235                 <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d1</span>;
<a name="l00236"></a>00236                 <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00237"></a>00237             <span class="vhdlkeyword">end</span>
<a name="l00238"></a>00238             <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &gt; <span class="vhdllogic">5&#39;d0</span> &amp;&amp; <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00239"></a>00239                  <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> + <span class="vhdllogic">5&#39;d1</span>;
<a name="l00240"></a>00240                  <a class="code" href="classcia8520.html#a3ac9f49f562604b082a4023ec0add13d">cnt_o</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00241"></a>00241                  <a class="code" href="classcia8520.html#a4f5d392cf19a60f0a9e24b019b2f9c70">sp_o</a> &lt;= <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a>[<span class="vhdllogic">7</span>];
<a name="l00242"></a>00242                  <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a> &lt;= { <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">0</span>], <span class="vhdllogic">1&#39;b0</span> };
<a name="l00243"></a>00243             <span class="vhdlkeyword">end</span>
<a name="l00244"></a>00244             <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &gt; <span class="vhdllogic">5&#39;d0</span> &amp;&amp; <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00245"></a>00245                  <a class="code" href="classcia8520.html#a3ac9f49f562604b082a4023ec0add13d">cnt_o</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00246"></a>00246                  <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> == <span class="vhdllogic">5&#39;d16</span>) <span class="vhdlkeyword">begin</span>
<a name="l00247"></a>00247                     <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> == <span class="vhdllogic">1&#39;b0</span>) <span class="vhdlkeyword">begin</span>
<a name="l00248"></a>00248                         <a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00249"></a>00249                         <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d0</span>;
<a name="l00250"></a>00250                     <span class="vhdlkeyword">end</span>
<a name="l00251"></a>00251                     <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">begin</span>
<a name="l00252"></a>00252                         <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a> &lt;= <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a>;
<a name="l00253"></a>00253                         <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d1</span>;
<a name="l00254"></a>00254                         <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00255"></a>00255                     <span class="vhdlkeyword">end</span>
<a name="l00256"></a>00256                  <span class="vhdlkeyword">end</span>
<a name="l00257"></a>00257                  <span class="vhdlkeyword">else</span> <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> + <span class="vhdllogic">5&#39;d1</span>;
<a name="l00258"></a>00258             <span class="vhdlkeyword">end</span>
<a name="l00259"></a>00259         <span class="vhdlkeyword">end</span>
<a name="l00260"></a>00260         <span class="keyword">// serial input</span>
<a name="l00261"></a>00261         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">begin</span>
<a name="l00262"></a>00262             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#af360efc39c1560425a58f4344ed90e89">last_cnt_i</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#ac1ffbdf42f2811fb7c322367ab022bde">cnt_i</a> == <span class="vhdllogic">1&#39;b1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00263"></a>00263                 <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a> &lt;= { <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">0</span>], <a class="code" href="classcia8520.html#a0d394218047f203560d75a3cd380ac3e">sp_i</a> };
<a name="l00264"></a>00264                 
<a name="l00265"></a>00265                 <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> == <span class="vhdllogic">5&#39;d7</span>) <span class="vhdlkeyword">begin</span>
<a name="l00266"></a>00266                     <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d0</span>;
<a name="l00267"></a>00267                     <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a> &lt;= { <a class="code" href="classcia8520.html#ae7e916c6f97de60289bd3db08a46ecd8">serial_shift</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">0</span>], <a class="code" href="classcia8520.html#a0d394218047f203560d75a3cd380ac3e">sp_i</a> };
<a name="l00268"></a>00268                     <a class="code" href="classcia8520.html#a143b97fea35027f71aef60115f2fc961">serial_irq</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00269"></a>00269                     <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d0</span>;
<a name="l00270"></a>00270                 <span class="vhdlkeyword">end</span>
<a name="l00271"></a>00271                 <span class="vhdlkeyword">else</span> <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> + <span class="vhdllogic">5&#39;d1</span>;
<a name="l00272"></a>00272             <span class="vhdlkeyword">end</span>
<a name="l00273"></a>00273         <span class="vhdlkeyword">end</span>
<a name="l00274"></a>00274         
<a name="l00275"></a>00275         <span class="keyword">// Timer A</span>
<a name="l00276"></a>00276         <span class="keyword">// PBON==on, OUTMODE==toggle, START==on</span>
<a name="l00277"></a>00277         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">2</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">6</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00278"></a>00278         <span class="keyword">// PBON==on, OUTMODE==pulse</span>
<a name="l00279"></a>00279         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">2</span>] == <span class="vhdllogic">1&#39;b0</span>) <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">6</span>] &lt;= <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a>;
<a name="l00280"></a>00280         
<a name="l00281"></a>00281         <span class="keyword">// START==on, RUNMODE==single-shot, underflowa</span>
<a name="l00282"></a>00282         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">3</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00283"></a>00283         
<a name="l00284"></a>00284         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00285"></a>00285         
<a name="l00286"></a>00286         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#abedeaa7155bf5185420b5dd4606982bc">timera_force_load</a> == <span class="vhdllogic">1&#39;b1</span> || <a class="code" href="classcia8520.html#a8fa6fd5e096036071cf0899aed4da3d3">timera_loadhigh_when_stopped</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a> &lt;= <a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">timera_latch</a>;
<a name="l00287"></a>00287         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#af390e1e0016a3461c18b6912b7d76439">timera_tick</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a> == <span class="vhdllogic">16&#39;d1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00288"></a>00288             <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a> &lt;= <a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">timera_latch</a>;
<a name="l00289"></a>00289             <a class="code" href="classcia8520.html#a4e249d8ebfbf83bef204cf254f05eb89">underflowa</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00290"></a>00290         <span class="vhdlkeyword">end</span>
<a name="l00291"></a>00291         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#af390e1e0016a3461c18b6912b7d76439">timera_tick</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a> &lt;= <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a> - <span class="vhdllogic">16&#39;d1</span>;
<a name="l00292"></a>00292         
<a name="l00293"></a>00293         
<a name="l00294"></a>00294         <span class="keyword">// Timer B</span>
<a name="l00295"></a>00295         <span class="keyword">// PBON==on, OUTMODE==toggle, START==on</span>
<a name="l00296"></a>00296         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">2</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">7</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00297"></a>00297         <span class="keyword">// PBON==on, OUTMODE==pulse</span>
<a name="l00298"></a>00298         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">2</span>] == <span class="vhdllogic">1&#39;b0</span>) <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">7</span>] &lt;= <a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a>;
<a name="l00299"></a>00299         
<a name="l00300"></a>00300         <span class="keyword">// START==on, RUNMODE==single-shot, underflowa</span>
<a name="l00301"></a>00301         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">3</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00302"></a>00302         
<a name="l00303"></a>00303         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00304"></a>00304         
<a name="l00305"></a>00305         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a1babb675cbb1c4dcb6727ff1f200f664">timerb_force_load</a> == <span class="vhdllogic">1&#39;b1</span> || <a class="code" href="classcia8520.html#a90ac5696f1dc1b4f2efa145ec93b1abf">timerb_loadhigh_when_stopped</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a> &lt;= <a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">timerb_latch</a>;
<a name="l00306"></a>00306         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a1f811c521a8b8c0598ba7819910b06f0">timerb_tick</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a> == <span class="vhdllogic">16&#39;d1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00307"></a>00307             <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a> &lt;= <a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">timerb_latch</a>;
<a name="l00308"></a>00308             <a class="code" href="classcia8520.html#a08f82276ab9a14c28a3653885242a19f">underflowb</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00309"></a>00309         <span class="vhdlkeyword">end</span>
<a name="l00310"></a>00310         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a1f811c521a8b8c0598ba7819910b06f0">timerb_tick</a> == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a> &lt;= <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a> - <span class="vhdllogic">16&#39;d1</span>;
<a name="l00311"></a>00311         
<a name="l00312"></a>00312         <span class="keyword">// Port Register A write</span>
<a name="l00313"></a>00313         <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d0</span>)         <a class="code" href="classcia8520.html#aea2105909da941728fed899d74afeff0">pa_o_reg</a> &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00314"></a>00314         <span class="keyword">// Port Register A read</span>
<a name="l00315"></a>00315         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d0</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= (<a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a> &amp; <a class="code" href="classcia8520.html#aea2105909da941728fed899d74afeff0">pa_o_reg</a>) | (~<a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a> &amp; <a class="code" href="classcia8520.html#aaa572548e346e473e4bd0d2a2b81e31b">pa_i</a>);
<a name="l00316"></a>00316         <span class="keyword">// Port Register B write</span>
<a name="l00317"></a>00317         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d1</span>) <span class="vhdlkeyword">begin</span>
<a name="l00318"></a>00318             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b0</span>)        <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a> &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00319"></a>00319             <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b0</span>)   {<a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">7</span>],<a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>]} &lt;= {<a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">7</span>],<a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>]};
<a name="l00320"></a>00320             <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span>)   <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">0</span>]               &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">0</span>];
<a name="l00321"></a>00321             <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">1</span>] == <span class="vhdllogic">1&#39;b1</span>)   <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>]               &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>];
<a name="l00322"></a>00322         <span class="vhdlkeyword">end</span>
<a name="l00323"></a>00323         <span class="keyword">// Port Register B read</span>
<a name="l00324"></a>00324         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d1</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= (<a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a> &amp; <a class="code" href="classcia8520.html#a58d2d914f09a63cccd748a7ada145e4d">pb_o_reg</a>) | (~<a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a> &amp; <a class="code" href="classcia8520.html#a24bf9b866e68ca32fc5594e5b7ea37dd">pb_i</a>);
<a name="l00325"></a>00325         <span class="keyword">// Data Direction Register A write</span>
<a name="l00326"></a>00326         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d2</span>)    <a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a> &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00327"></a>00327         <span class="keyword">// Data Direction Register A read</span>
<a name="l00328"></a>00328         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d2</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#a513382cca481c8a5618c4c06fc4c20c3">ddra</a>;
<a name="l00329"></a>00329         <span class="keyword">// Data Direction Register B write</span>
<a name="l00330"></a>00330         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d3</span>)    <a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a> &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00331"></a>00331         <span class="keyword">// Data Direction Register B read</span>
<a name="l00332"></a>00332         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d3</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#a846e07d7fa9306e9167a73d8a279f1c4">ddrb</a>;
<a name="l00333"></a>00333         
<a name="l00334"></a>00334         <span class="keyword">// Timer A Low byte write</span>
<a name="l00335"></a>00335         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d4</span>)    <a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">timera_latch</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00336"></a>00336         <span class="keyword">// Timer A Low byte read</span>
<a name="l00337"></a>00337         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d4</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>];
<a name="l00338"></a>00338         <span class="keyword">// Timer A High byte write</span>
<a name="l00339"></a>00339         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d5</span>) <span class="vhdlkeyword">begin</span>
<a name="l00340"></a>00340             <a class="code" href="classcia8520.html#ae178dbc26a2698c23a7605f3d7dffbdb">timera_latch</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00341"></a>00341             <span class="keyword">// START==off, RUNMODE==single-shot</span>
<a name="l00342"></a>00342             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">3</span>] == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">0</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00343"></a>00343         <span class="vhdlkeyword">end</span>
<a name="l00344"></a>00344         <span class="keyword">// Timer A High byte read</span>
<a name="l00345"></a>00345         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d5</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ada8973a933711aef9cf4f7fee672fe29">timera</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>];
<a name="l00346"></a>00346         
<a name="l00347"></a>00347         <span class="keyword">// Timer B Low byte write</span>
<a name="l00348"></a>00348         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d6</span>)    <a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">timerb_latch</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00349"></a>00349         <span class="keyword">// Timer B Low byte read</span>
<a name="l00350"></a>00350         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d6</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>];
<a name="l00351"></a>00351         <span class="keyword">// Timer B High byte write</span>
<a name="l00352"></a>00352         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d7</span>) <span class="vhdlkeyword">begin</span>
<a name="l00353"></a>00353             <a class="code" href="classcia8520.html#abd3fbc899b973e478cd7e3df16feb8b7">timerb_latch</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00354"></a>00354             <span class="keyword">// START==off, RUNMODE==single-shot</span>
<a name="l00355"></a>00355             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">3</span>] == <span class="vhdllogic">1&#39;b1</span>) <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">0</span>] &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00356"></a>00356         <span class="vhdlkeyword">end</span>
<a name="l00357"></a>00357         <span class="keyword">// Timer B High byte read</span>
<a name="l00358"></a>00358         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d7</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ad48421b9e581a71d16c98108b08f6342">timerb</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>];
<a name="l00359"></a>00359         
<a name="l00360"></a>00360         <span class="keyword">// TOD/ALARM low byte write</span>
<a name="l00361"></a>00361         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d8</span>) <span class="vhdlkeyword">begin</span>
<a name="l00362"></a>00362             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">6</span>] == <span class="vhdllogic">1&#39;b0</span>) <span class="vhdlkeyword">begin</span>
<a name="l00363"></a>00363                 <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00364"></a>00364                 <a class="code" href="classcia8520.html#a3eb6a5baa87f3a197a5cb1a9a3699a07">tod_write_stop</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00365"></a>00365             <span class="vhdlkeyword">end</span>
<a name="l00366"></a>00366             <span class="vhdlkeyword">else</span> <a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">tod_alarm</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00367"></a>00367         <span class="vhdlkeyword">end</span>
<a name="l00368"></a>00368         <span class="keyword">// TOD low byte read</span>
<a name="l00369"></a>00369         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d8</span>) <span class="vhdlkeyword">begin</span>
<a name="l00370"></a>00370             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">tod_read_latch</a> == <span class="vhdllogic">1&#39;b0</span>) <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>];
<a name="l00371"></a>00371             <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">begin</span>
<a name="l00372"></a>00372                 <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ab6c6b9ff872e5af9ecf775df56d03f83">tod_latch</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">0</span>];
<a name="l00373"></a>00373                 <a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">tod_read_latch</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00374"></a>00374             <span class="vhdlkeyword">end</span>
<a name="l00375"></a>00375         <span class="vhdlkeyword">end</span>
<a name="l00376"></a>00376         <span class="keyword">// TOD/ALARM mid byte write</span>
<a name="l00377"></a>00377         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d9</span>) <span class="vhdlkeyword">begin</span>
<a name="l00378"></a>00378             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">6</span>] == <span class="vhdllogic">1&#39;b0</span>) <span class="vhdlkeyword">begin</span>
<a name="l00379"></a>00379                 <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00380"></a>00380             <span class="vhdlkeyword">end</span>
<a name="l00381"></a>00381             <span class="vhdlkeyword">else</span> <a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">tod_alarm</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00382"></a>00382         <span class="vhdlkeyword">end</span>
<a name="l00383"></a>00383         <span class="keyword">// TOD mid byte read</span>
<a name="l00384"></a>00384         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d9</span>) <span class="vhdlkeyword">begin</span>
<a name="l00385"></a>00385             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">tod_read_latch</a> == <span class="vhdllogic">1&#39;b0</span>) <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>];
<a name="l00386"></a>00386             <span class="vhdlkeyword">else</span> <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ab6c6b9ff872e5af9ecf775df56d03f83">tod_latch</a>[<span class="vhdllogic">15</span>:<span class="vhdllogic">8</span>];
<a name="l00387"></a>00387         <span class="vhdlkeyword">end</span>
<a name="l00388"></a>00388         <span class="keyword">// TOD/ALARM high byte write</span>
<a name="l00389"></a>00389         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d10</span>) <span class="vhdlkeyword">begin</span>
<a name="l00390"></a>00390             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">6</span>] == <span class="vhdllogic">1&#39;b0</span>) <span class="vhdlkeyword">begin</span>
<a name="l00391"></a>00391                 <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>[<span class="vhdllogic">23</span>:<span class="vhdllogic">16</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00392"></a>00392                 <a class="code" href="classcia8520.html#a3eb6a5baa87f3a197a5cb1a9a3699a07">tod_write_stop</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00393"></a>00393             <span class="vhdlkeyword">end</span>
<a name="l00394"></a>00394             <span class="vhdlkeyword">else</span> <a class="code" href="classcia8520.html#adcd479acfe899597982f270df4ad81b5">tod_alarm</a>[<span class="vhdllogic">23</span>:<span class="vhdllogic">16</span>] &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00395"></a>00395         <span class="vhdlkeyword">end</span>
<a name="l00396"></a>00396         <span class="keyword">// TOD high byte read</span>
<a name="l00397"></a>00397         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d10</span>) <span class="vhdlkeyword">begin</span>
<a name="l00398"></a>00398             <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>[<span class="vhdllogic">23</span>:<span class="vhdllogic">16</span>];
<a name="l00399"></a>00399             <a class="code" href="classcia8520.html#ab6c6b9ff872e5af9ecf775df56d03f83">tod_latch</a> &lt;= <a class="code" href="classcia8520.html#a944c8e8722357c8ee997aa3ca4f3b510">tod_counter</a>;
<a name="l00400"></a>00400             <a class="code" href="classcia8520.html#a018c4773d815ddc972652c4da9601f50">tod_read_latch</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00401"></a>00401         <span class="vhdlkeyword">end</span>
<a name="l00402"></a>00402         <span class="keyword">// empty register write</span>
<a name="l00403"></a>00403         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d11</span>) <span class="vhdlkeyword">begin</span>
<a name="l00404"></a>00404         <span class="vhdlkeyword">end</span>
<a name="l00405"></a>00405         <span class="keyword">// empty register read</span>
<a name="l00406"></a>00406         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d11</span>)   <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <span class="vhdllogic">8&#39;d0</span>;
<a name="l00407"></a>00407         <span class="keyword">// Serial Data Register write</span>
<a name="l00408"></a>00408         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d12</span>) <span class="vhdlkeyword">begin</span>
<a name="l00409"></a>00409             <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a> &lt;= <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>;
<a name="l00410"></a>00410             <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00411"></a>00411         <span class="vhdlkeyword">end</span>
<a name="l00412"></a>00412         <span class="keyword">// Serial Data Register read</span>
<a name="l00413"></a>00413         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d12</span>)    <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= <a class="code" href="classcia8520.html#ac8d128e7618225ec328efa8a11fb9141">serial_latch</a>;
<a name="l00414"></a>00414         <span class="keyword">// Interrupt Control Register write</span>
<a name="l00415"></a>00415         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d13</span>) <span class="vhdlkeyword">begin</span>
<a name="l00416"></a>00416             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">7</span>] == <span class="vhdllogic">1&#39;b1</span>)  <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a> &lt;= <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a> | <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>];
<a name="l00417"></a>00417             <span class="vhdlkeyword">else</span>                  <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a> &lt;= <a class="code" href="classcia8520.html#a65d1b3454257645e76ed32867816a973">icr_mask</a> &amp; (~<a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">0</span>]);
<a name="l00418"></a>00418         <span class="vhdlkeyword">end</span>
<a name="l00419"></a>00419         <span class="keyword">// Interrupt Control Register read</span>
<a name="l00420"></a>00420         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d13</span>)   <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= { <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">5</span>], <span class="vhdllogic">2&#39;b0</span>, <a class="code" href="classcia8520.html#a46657a6abfe37aaf512235a2bba74b2c">icr_data</a>[<span class="vhdllogic">4</span>:<span class="vhdllogic">0</span>] };
<a name="l00421"></a>00421          
<a name="l00422"></a>00422         <span class="keyword">// Control Register A write</span>
<a name="l00423"></a>00423         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d14</span>) <span class="vhdlkeyword">begin</span>
<a name="l00424"></a>00424             <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a> &lt;= { <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">5</span>], <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">3</span>:<span class="vhdllogic">0</span>] };
<a name="l00425"></a>00425             
<a name="l00426"></a>00426             <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">5</span>] != <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">6</span>]) <span class="vhdlkeyword">begin</span>
<a name="l00427"></a>00427                 <a class="code" href="classcia8520.html#ab4f567929d2e1ae0310c2d455dabb98b">serial_latched</a> &lt;= <span class="vhdllogic">1&#39;b0</span>;
<a name="l00428"></a>00428                 <a class="code" href="classcia8520.html#ae49a41d301a085fc0ab1711e7c53f9e4">serial_counter</a> &lt;= <span class="vhdllogic">5&#39;d0</span>;
<a name="l00429"></a>00429                 
<a name="l00430"></a>00430                 <a class="code" href="classcia8520.html#a3ac9f49f562604b082a4023ec0add13d">cnt_o</a> &lt;= <span class="vhdllogic">1&#39;b1</span>;
<a name="l00431"></a>00431                 <a class="code" href="classcia8520.html#a4f5d392cf19a60f0a9e24b019b2f9c70">sp_o</a> &lt;= (<a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">6</span>] == <span class="vhdllogic">1&#39;b0</span>) ? <span class="vhdllogic">1&#39;b1</span> : <span class="vhdllogic">1&#39;b0</span>;
<a name="l00432"></a>00432             <span class="vhdlkeyword">end</span>
<a name="l00433"></a>00433         <span class="vhdlkeyword">end</span>
<a name="l00434"></a>00434         <span class="keyword">// Control Register A read</span>
<a name="l00435"></a>00435         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d14</span>)   <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= { <span class="vhdllogic">1&#39;b0</span>, <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">5</span>:<span class="vhdllogic">4</span>], <span class="vhdllogic">1&#39;b0</span>, <a class="code" href="classcia8520.html#a29b61e4de0b5173e5cb981ddafb53520">cra</a>[<span class="vhdllogic">3</span>:<span class="vhdllogic">0</span>] };
<a name="l00436"></a>00436         <span class="keyword">// Control Register B write</span>
<a name="l00437"></a>00437         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d15</span>)   <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a> &lt;= { <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">7</span>:<span class="vhdllogic">5</span>], <a class="code" href="classcia8520.html#a498e0a7d3556697f2e64c422e002ec63">DAT_I</a>[<span class="vhdllogic">3</span>:<span class="vhdllogic">0</span>] };
<a name="l00438"></a>00438         <span class="keyword">// Control Register B read</span>
<a name="l00439"></a>00439         <span class="vhdlkeyword">else</span> <span class="vhdlkeyword">if</span>(<a class="code" href="classcia8520.html#ab8eb2ffa770fd5ef1b8e5b3fee0c14c8">CYC_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a487a6c21786fdd7c088fd03f26243089">STB_I</a> == <span class="vhdllogic">1&#39;b1</span> &amp;&amp; <a class="code" href="classcia8520.html#a5df15d7312a6e8708bfa7fb9a05869b5">WE_I</a> == <span class="vhdllogic">1&#39;b0</span> &amp;&amp; <a class="code" href="classcia8520.html#a800b1014ad22379fa8361f2ed46cd1c4">ADR_I</a> == <span class="vhdllogic">4&#39;d15</span>)   <a class="code" href="classcia8520.html#abf757a9279afcc5b87520ac1d753ea20">DAT_O</a> &lt;= { <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">6</span>:<span class="vhdllogic">4</span>], <span class="vhdllogic">1&#39;b0</span>, <a class="code" href="classcia8520.html#a9610c862cf661f47439da35752ec16b2">crb</a>[<span class="vhdllogic">3</span>:<span class="vhdllogic">0</span>] };
<a name="l00440"></a>00440     <span class="vhdlkeyword">end</span>
<a name="l00441"></a>00441 <span class="vhdlkeyword">end</span>
<a name="l00442"></a>00442 
<a name="l00443"></a>00443 <span class="vhdlkeyword">endmodule</span>
<a name="l00444"></a>00444 
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Dec 20 2010 21:20:18 for aoOCS by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.