<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.elphel.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JeremViewsurf</id>
	<title>ElphelWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.elphel.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JeremViewsurf"/>
	<link rel="alternate" type="text/html" href="https://wiki.elphel.com/wiki/Special:Contributions/JeremViewsurf"/>
	<updated>2026-08-01T21:38:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3777</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3777"/>
		<updated>2008-05-22T14:07:30Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I carried out the synthesis of the design with ISE, I am able to get the .bit file with some warnings (old constraints file from 353 : some timings not met, some clocks warnings and obviously unused signals) but no error. I started to have a look at the driver and made a first version of the definition file x3x3.h (see CVS). Some macros at the end may be obsolete as they command the 353 memory controller. --[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Problem while compiling with definition file x3x3.h :&lt;br /&gt;
 Making install in packages/os/linux-2.6 for crisv32-axis-linux-gnu&lt;br /&gt;
 make[2]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/packages/os/linux-2.6-R1_4_2 »&lt;br /&gt;
 subdirs=&lt;br /&gt;
   MAKE    /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6 zImage&lt;br /&gt;
 make[3]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6-tag--devboard-R2_10-4 »&lt;br /&gt;
   CHK     include/linux/version.h&lt;br /&gt;
   CHK     include/linux/utsrelease.h&lt;br /&gt;
   CHK     include/linux/compile.h&lt;br /&gt;
   CC      arch/cris/arch-v32/drivers/elphel/fpgajtag.o&lt;br /&gt;
 In file included from arch/cris/arch-v32/drivers/elphel/fpgajtag.c:95:&lt;br /&gt;
 arch/cris/arch-v32/drivers/elphel/x3x3.h:963:45: &amp;quot;[&amp;quot; may not appear in macro parameter list&lt;br /&gt;
 make[5]: *** [arch/cris/arch-v32/drivers/elphel/fpgajtag.o] Erreur 1&lt;br /&gt;
&lt;br /&gt;
At the first occurrence of #include &amp;quot;x3x3.h&amp;quot; some 353 macros such as #define X313_IRQSTATE(port_csp0_addr[0x11],port_csp0_addr[0x11]) with the &amp;quot;[&amp;quot; character stops the compilation. --[[User:JeremViewsurf|JeremViewsurf]] 10:48, 21 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Strange. Could you pls use LANG=CC ? So others will be able to read error messages too :) What GNU/Linux distribution do you use ? what version of gcc-cris? Also it would be better to sync to last CVS, many bugs was resolved since .11. --[[User:Polto|Alexandre.Poltorak]] 12:45, 21 April 2008 (CDT)&lt;br /&gt;
In the http://elphel.cvs.sourceforge.net/elphel/elphel353-7.1/os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/x353.h?view=markup &lt;br /&gt;
1053: #define X313_IRQSTATE (port_csp0_addr[0x11],port_csp0_addr[0x11])&lt;br /&gt;
there is a space between &amp;quot;X313_IRQSTATE&amp;quot; and &amp;quot;(&amp;quot; separating macro name with 0 parameters and the macro body. Where could that space character disappear in your example?--[[User:Andrey.filippov|Andrey.filippov]] 14:22, 21 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Andrey is right, that was just a stupid space problem... By the way, I&#039;ll get the latest version of the source code as I&#039;m working on the driver (well just trying to understand how is it structured right now...). Thanks for the quick answer. --[[User:JeremViewsurf|JeremViewsurf]] 02:17, 22 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Working on the driver made me realize that the compressor never reached the end of a frame... The compressor just stopped processing data after a while and a bunch of signal switched to an undetermined state. I was working on this issue and realized that I got a problem with clock phases and data was written to wrong locations in the sdram. Now it looks like it&#039;s fixed, I don&#039;t have undetermined signals anymore and the done_compress signal goes high after a frame is processed. Fixed files have been committed.&lt;br /&gt;
&lt;br /&gt;
I am now dealing with interrupts and I can&#039;t make the IRQ signal go high when done_compress is high like the 333 design. In the 333 design there&#039;s a simple interrupt manager that let the irq go through according to a certain mask value. However I don&#039;t understand how the 353 interrupt vector block works... At that time I just plugged the interrupt sources (done_compress, reset_compress etc) in the irq_in input but obviously I think there are more to do to make that work. --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 22 May 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
By the way, I tried to use the old 333 interrupts manager block with the new design and it seems to work with the simulation (IRQ goes high for some time when the frame is done processing). However I&#039;m stuck with how to modify the device driver with this design, (R_IRQ_MASK0_SET used but undeclared). --[[User:JeremViewsurf|JeremViewsurf]] 09:07, 22 May 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3776</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3776"/>
		<updated>2008-05-22T08:32:03Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I carried out the synthesis of the design with ISE, I am able to get the .bit file with some warnings (old constraints file from 353 : some timings not met, some clocks warnings and obviously unused signals) but no error. I started to have a look at the driver and made a first version of the definition file x3x3.h (see CVS). Some macros at the end may be obsolete as they command the 353 memory controller. --[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Problem while compiling with definition file x3x3.h :&lt;br /&gt;
 Making install in packages/os/linux-2.6 for crisv32-axis-linux-gnu&lt;br /&gt;
 make[2]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/packages/os/linux-2.6-R1_4_2 »&lt;br /&gt;
 subdirs=&lt;br /&gt;
   MAKE    /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6 zImage&lt;br /&gt;
 make[3]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6-tag--devboard-R2_10-4 »&lt;br /&gt;
   CHK     include/linux/version.h&lt;br /&gt;
   CHK     include/linux/utsrelease.h&lt;br /&gt;
   CHK     include/linux/compile.h&lt;br /&gt;
   CC      arch/cris/arch-v32/drivers/elphel/fpgajtag.o&lt;br /&gt;
 In file included from arch/cris/arch-v32/drivers/elphel/fpgajtag.c:95:&lt;br /&gt;
 arch/cris/arch-v32/drivers/elphel/x3x3.h:963:45: &amp;quot;[&amp;quot; may not appear in macro parameter list&lt;br /&gt;
 make[5]: *** [arch/cris/arch-v32/drivers/elphel/fpgajtag.o] Erreur 1&lt;br /&gt;
&lt;br /&gt;
At the first occurrence of #include &amp;quot;x3x3.h&amp;quot; some 353 macros such as #define X313_IRQSTATE(port_csp0_addr[0x11],port_csp0_addr[0x11]) with the &amp;quot;[&amp;quot; character stops the compilation. --[[User:JeremViewsurf|JeremViewsurf]] 10:48, 21 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Strange. Could you pls use LANG=CC ? So others will be able to read error messages too :) What GNU/Linux distribution do you use ? what version of gcc-cris? Also it would be better to sync to last CVS, many bugs was resolved since .11. --[[User:Polto|Alexandre.Poltorak]] 12:45, 21 April 2008 (CDT)&lt;br /&gt;
In the http://elphel.cvs.sourceforge.net/elphel/elphel353-7.1/os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/x353.h?view=markup &lt;br /&gt;
1053: #define X313_IRQSTATE (port_csp0_addr[0x11],port_csp0_addr[0x11])&lt;br /&gt;
there is a space between &amp;quot;X313_IRQSTATE&amp;quot; and &amp;quot;(&amp;quot; separating macro name with 0 parameters and the macro body. Where could that space character disappear in your example?--[[User:Andrey.filippov|Andrey.filippov]] 14:22, 21 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Andrey is right, that was just a stupid space problem... By the way, I&#039;ll get the latest version of the source code as I&#039;m working on the driver (well just trying to understand how is it structured right now...). Thanks for the quick answer. --[[User:JeremViewsurf|JeremViewsurf]] 02:17, 22 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Working on the driver made me realize that the compressor never reached the end of a frame... The compressor just stopped processing data after a while and a bunch of signal switched to an undetermined state. I was working on this issue and realized that I got a problem with clock phases and data was written to wrong locations in the sdram. Now it looks like it&#039;s fixed, I don&#039;t have undetermined signals anymore and the done_compress signal goes high after a frame is processed. Fixed files have been committed.&lt;br /&gt;
&lt;br /&gt;
I am now dealing with interrupts and I can&#039;t make the IRQ signal go high when done_compress is high like the 333 design. In the 333 design there&#039;s a simple interrupt manager that let the irq go through according to a certain mask value. However I don&#039;t understand how the 353 interrupt vector block works... At that time I just plugged the interrupt sources (done_compress, reset_compress etc) in the irq_in input but obviously I think there are mor to do to make that work. --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 22 May 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3775</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3775"/>
		<updated>2008-04-22T07:17:50Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I carried out the synthesis of the design with ISE, I am able to get the .bit file with some warnings (old constraints file from 353 : some timings not met, some clocks warnings and obviously unused signals) but no error. I started to have a look at the driver and made a first version of the definition file x3x3.h (see CVS). Some macros at the end may be obsolete as they command the 353 memory controller. --[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Problem while compiling with definition file x3x3.h :&lt;br /&gt;
 Making install in packages/os/linux-2.6 for crisv32-axis-linux-gnu&lt;br /&gt;
 make[2]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/packages/os/linux-2.6-R1_4_2 »&lt;br /&gt;
 subdirs=&lt;br /&gt;
   MAKE    /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6 zImage&lt;br /&gt;
 make[3]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6-tag--devboard-R2_10-4 »&lt;br /&gt;
   CHK     include/linux/version.h&lt;br /&gt;
   CHK     include/linux/utsrelease.h&lt;br /&gt;
   CHK     include/linux/compile.h&lt;br /&gt;
   CC      arch/cris/arch-v32/drivers/elphel/fpgajtag.o&lt;br /&gt;
 In file included from arch/cris/arch-v32/drivers/elphel/fpgajtag.c:95:&lt;br /&gt;
 arch/cris/arch-v32/drivers/elphel/x3x3.h:963:45: &amp;quot;[&amp;quot; may not appear in macro parameter list&lt;br /&gt;
 make[5]: *** [arch/cris/arch-v32/drivers/elphel/fpgajtag.o] Erreur 1&lt;br /&gt;
&lt;br /&gt;
At the first occurrence of #include &amp;quot;x3x3.h&amp;quot; some 353 macros such as #define X313_IRQSTATE(port_csp0_addr[0x11],port_csp0_addr[0x11]) with the &amp;quot;[&amp;quot; character stops the compilation. --[[User:JeremViewsurf|JeremViewsurf]] 10:48, 21 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Strange. Could you pls use LANG=CC ? So others will be able to read error messages too :) What GNU/Linux distribution do you use ? what version of gcc-cris? Also it would be better to sync to last CVS, many bugs was resolved since .11. --[[User:Polto|Alexandre.Poltorak]] 12:45, 21 April 2008 (CDT)&lt;br /&gt;
In the http://elphel.cvs.sourceforge.net/elphel/elphel353-7.1/os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/x353.h?view=markup &lt;br /&gt;
1053: #define X313_IRQSTATE (port_csp0_addr[0x11],port_csp0_addr[0x11])&lt;br /&gt;
there is a space between &amp;quot;X313_IRQSTATE&amp;quot; and &amp;quot;(&amp;quot; separating macro name with 0 parameters and the macro body. Where could that space character disappear in your example?--[[User:Andrey.filippov|Andrey.filippov]] 14:22, 21 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Andrey is right, that was just a stupid space problem... By the way, I&#039;ll get the latest version of the source code as I&#039;m working on the driver (well just trying to understand how is it structured right now...). Thanks for the quick answer. --[[User:JeremViewsurf|JeremViewsurf]] 02:17, 22 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3772</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3772"/>
		<updated>2008-04-21T15:48:43Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I carried out the synthesis of the design with ISE, I am able to get the .bit file with some warnings (old constraints file from 353 : some timings not met, some clocks warnings and obviously unused signals) but no error. I started to have a look at the driver and made a first version of the definition file x3x3.h (see CVS). Some macros at the end may be obsolete as they command the 353 memory controller. --[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Problem while compiling with definition file x3x3.h :&lt;br /&gt;
 Making install in packages/os/linux-2.6 for crisv32-axis-linux-gnu&lt;br /&gt;
 make[2]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/packages/os/linux-2.6-R1_4_2 »&lt;br /&gt;
 subdirs=&lt;br /&gt;
   MAKE    /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6 zImage&lt;br /&gt;
 make[3]: entrant dans le répertoire « /home/larrey/Elphel/353t_clean/elphel353-7.1.7.11/elphel353t/os/linux-2.6-tag--devboard-R2_10-4 »&lt;br /&gt;
   CHK     include/linux/version.h&lt;br /&gt;
   CHK     include/linux/utsrelease.h&lt;br /&gt;
   CHK     include/linux/compile.h&lt;br /&gt;
   CC      arch/cris/arch-v32/drivers/elphel/fpgajtag.o&lt;br /&gt;
 In file included from arch/cris/arch-v32/drivers/elphel/fpgajtag.c:95:&lt;br /&gt;
 arch/cris/arch-v32/drivers/elphel/x3x3.h:963:45: &amp;quot;[&amp;quot; may not appear in macro parameter list&lt;br /&gt;
 make[5]: *** [arch/cris/arch-v32/drivers/elphel/fpgajtag.o] Erreur 1&lt;br /&gt;
&lt;br /&gt;
At the first occurrence of #include &amp;quot;x3x3.h&amp;quot; some 353 macros such as #define X313_IRQSTATE(port_csp0_addr[0x11],port_csp0_addr[0x11]) with the &amp;quot;[&amp;quot; character stops the compilation. --[[User:JeremViewsurf|JeremViewsurf]] 10:48, 21 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3771</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3771"/>
		<updated>2008-04-17T14:08:51Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I carried out the synthesis of the design with ISE, I am able to get the .bit file with some warnings (old constraints file from 353 : some timings not met, some clocks warnings and obviously unused signals) but no error. I started to have a look at the driver and made a first version of the definition file x3x3.h (see CVS). Some macros at the end may be obsolete as they command the 353 memory controller. --[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3770</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3770"/>
		<updated>2008-04-17T13:32:14Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I carried out the synthesis of the design with ISE, I am able to get the .bit file with some warnings (old constraints file from 353 : some timings not met, some clocks warnings and obviously unused signals) but no error. I started to have a look at the driver and made a first version of the definition file x3x3.h (see CVS). Some macros at the end may be obsolete as they command the 353 memory controller. --[[User:JeremViewsurf|JeremViewsurf]] 08:32, 17 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3727</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3727"/>
		<updated>2008-04-16T14:16:31Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Compressor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table address (X313_WA_COMP_TA=0x2d)&lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data (X313_WA_COMP_TD=0x2c)&lt;br /&gt;
&lt;br /&gt;
Example : Writing zerobin and quantization tables in 353 Theora design&lt;br /&gt;
&lt;br /&gt;
[[Image:Writetabs.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
*  ia = 0x0e and idi = table address &lt;br /&gt;
&lt;br /&gt;
then&lt;br /&gt;
&lt;br /&gt;
* ia = 0x0f and idi = table data &lt;br /&gt;
&lt;br /&gt;
Table address is not autoincremented within the sensorpix block but is fed externally with the ta bus.&lt;br /&gt;
&lt;br /&gt;
[[Image:Gammatab.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3726</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3726"/>
		<updated>2008-04-16T14:15:53Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Compressor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* (X313_WA_COMP_TA)ia = 0x2d and idi = table address (X313_WA_COMP_TA=0x2d)&lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data (X313_WA_COMP_TD=0x2c)&lt;br /&gt;
&lt;br /&gt;
Example : Writing zerobin and quantization tables in 353 Theora design&lt;br /&gt;
&lt;br /&gt;
[[Image:Writetabs.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
*  ia = 0x0e and idi = table address &lt;br /&gt;
&lt;br /&gt;
then&lt;br /&gt;
&lt;br /&gt;
* ia = 0x0f and idi = table data &lt;br /&gt;
&lt;br /&gt;
Table address is not autoincremented within the sensorpix block but is fed externally with the ta bus.&lt;br /&gt;
&lt;br /&gt;
[[Image:Gammatab.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3769</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3769"/>
		<updated>2008-04-14T09:07:48Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Jeremy, what frame size do you try to simulate ? You should try on a minimal: 32x128. Look on the 333 Theora testbench for more info. --[[User:Polto|Alexandre.Poltorak]] 14:28, 11 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I realized that I did not check the frame dimensions and I tried to simulate 1280x1024 frames (init_dimensions(9,7)). I changed to init_dimensions(1,1) thus setting nstx and nsty to 1. I now have output on ch7 after 2 ms, thanks. --[[User:JeremViewsurf|JeremViewsurf]] 04:07, 14 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3767</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3767"/>
		<updated>2008-04-11T12:53:20Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At last, I have some output after the memory controller channel 7 after 5h30 of simulation... Basically it seems that a whole frame have to be processed before having any output. Maybe changing nstx and nsty (number of blocks in a row and rows in a frame) parameters would reduce simulation time. &lt;br /&gt;
&lt;br /&gt;
[[Image:Finaldatapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 07:53, 11 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=File:Finaldatapath.jpg&amp;diff=3896</id>
		<title>File:Finaldatapath.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=File:Finaldatapath.jpg&amp;diff=3896"/>
		<updated>2008-04-11T12:47:36Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: Finally some output after the dma_fifo block&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Finally some output after the dma_fifo block&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3766</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3766"/>
		<updated>2008-04-10T09:41:07Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I needed to copy &#039;defines333.vh&#039; and &#039;*.dat&#039;s from theora/ folder.--[[User:Oleg|Oleg]] 03:59, 10 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7 (after mcontr_tok_rd to be more precise). --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3725</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3725"/>
		<updated>2008-04-09T15:41:33Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Sensorpix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table address &lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data&lt;br /&gt;
&lt;br /&gt;
Example : Writing zerobin and quantization tables in 353 Theora design&lt;br /&gt;
&lt;br /&gt;
[[Image:Writetabs.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
*  ia = 0x0e and idi = table address &lt;br /&gt;
&lt;br /&gt;
then&lt;br /&gt;
&lt;br /&gt;
* ia = 0x0f and idi = table data &lt;br /&gt;
&lt;br /&gt;
Table address is not autoincremented within the sensorpix block but is fed externally with the ta bus.&lt;br /&gt;
&lt;br /&gt;
[[Image:Gammatab.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3724</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3724"/>
		<updated>2008-04-09T15:41:05Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Sensorpix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table address &lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data&lt;br /&gt;
&lt;br /&gt;
Example : Writing zerobin and quantization tables in 353 Theora design&lt;br /&gt;
&lt;br /&gt;
[[Image:Writetabs.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
*  ia = 0x0e and idi = table address &lt;br /&gt;
&lt;br /&gt;
then&lt;br /&gt;
&lt;br /&gt;
* ia = 0x0f and idi = table data &lt;br /&gt;
&lt;br /&gt;
Table address is not autoincremented within the sensorpix block but is fed externally with the ta bus.&lt;br /&gt;
&lt;br /&gt;
[[Image:.Gammatab.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=File:Gammatab.jpg&amp;diff=3895</id>
		<title>File:Gammatab.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=File:Gammatab.jpg&amp;diff=3895"/>
		<updated>2008-04-09T15:40:50Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: Writing gamma tables in sensorpix block&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Writing gamma tables in sensorpix block&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3723</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3723"/>
		<updated>2008-04-09T15:37:17Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Compressor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table start address &lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data&lt;br /&gt;
&lt;br /&gt;
The write address is then autoincremented.&lt;br /&gt;
&lt;br /&gt;
Example : Writing zerobin and quantization tables in 353 Theora design&lt;br /&gt;
&lt;br /&gt;
[[Image:Writetabs.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3722</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3722"/>
		<updated>2008-04-09T15:17:08Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Compressor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table address &lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data&lt;br /&gt;
&lt;br /&gt;
Example : Writing zerobin and quantization tables in 353 Theora design&lt;br /&gt;
&lt;br /&gt;
[[Image:Writetabs.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=File:Writetabs.jpg&amp;diff=3894</id>
		<title>File:Writetabs.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=File:Writetabs.jpg&amp;diff=3894"/>
		<updated>2008-04-09T15:15:54Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: Writing zerobin and quantization tables in 353 theora design&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Writing zerobin and quantization tables in 353 theora design&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3721</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3721"/>
		<updated>2008-04-09T15:09:52Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Compressor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table address &lt;br /&gt;
then&lt;br /&gt;
* ia = 0x2c and idi = table data&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3720</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3720"/>
		<updated>2008-04-09T15:09:09Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Compressor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
Writing tables in compressor (and mcontr8ch) is the same than the 333 design :&lt;br /&gt;
* ia = 0x2d and idi = table address &lt;br /&gt;
* ia = 0x2c and idi = table data&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3719</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3719"/>
		<updated>2008-04-09T15:00:33Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Sensorpix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Most of the 353 design was used for the new design. Writing procedure for gamma tables in sensorpix block is the same than in 353 (ie with ta bus and twr_gamma signal).&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3763</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3763"/>
		<updated>2008-04-09T09:50:00Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! I looked at the waves, still no output after ch7. --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3762</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3762"/>
		<updated>2008-04-09T08:44:21Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I&#039;m now trying with a 5 ms delay and without $stop after the delay, the simulation is currently at 2.3 ms and is still running ! --[[User:JeremViewsurf|JeremViewsurf]] 03:44, 9 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3761</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3761"/>
		<updated>2008-04-09T08:43:30Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is now a 5ms delay (#5000000) to let the simulation run, it stops at 700µs...  --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3760</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3760"/>
		<updated>2008-04-09T07:24:48Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;simulation over 2ms&amp;quot; - $stop in line 639 of x353t.tf finishes the simulation. And there&#039;s one file is missing in cvs - linear1028rgb.dat - Jeremy, could you upload it.--[[User:Oleg|Oleg]] 11:44, 8 April 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The missing file is now on the cvs, let me know if something else is missing. If you want to check the set of signals in my simulation above, use pxdpath.sav in gtkwave. Before $stop in line 639 of x353t.tf there is a 5ms delay (#5000000) to let the simulation run, I don&#039;t understand why it stops at 2ms... --[[User:JeremViewsurf|JeremViewsurf]] 02:24, 9 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3758</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3758"/>
		<updated>2008-04-07T12:35:58Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time. Maybe the second stage of the compressor processes data after 2 ms so it is never reached by the simulator (?)&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3757</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3757"/>
		<updated>2008-04-07T10:17:30Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The 5MPix sensor does have 12 bit output and all the bits are used during &amp;quot;gamma&amp;quot;-table conversion to 8 bits. Even more - the same FPGA code now supports 10347 boards (for Kodak KAI-11002/16000 CCD sensors) that produce 14-bit data.&lt;br /&gt;
&lt;br /&gt;
After the data (10-12-14 bits) reaches the FPGA, it can go two ways - through the LUT (with linear interpolation) conversion to 8 bits and raw - 2 bytes/pixel format, where pixel data is MSB-aligned (actually bit 14 being the highest, bit 15 is left 0 to allow subtraction without overflow). I believe you should use that part (from the sensor interface to the SDRAM - including gamma tables and histograms) the same for Theora as it is now in 353 (for JPEG)--[[User:Andrey.filippov|Andrey.filippov]] 12:09, 31 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I restored the sensorpix353 and sensortrig353 in the Theora design and tested the data path from the sensor to the dma output. Looks like there is no data coming out of the mcontr channel 7 (after the token read buffer). Same issue with the 333 Theora simulation although the design is obviously correct. This might be a flaw in the testbench (?) as I used somehow the same for the two designs. Moreover I can&#039;t simulated over 2ms and I can&#039;t figure out why the simulations stops at that time.&lt;br /&gt;
&lt;br /&gt;
[[Image:Datapath.jpg]]&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 05:17, 7 April 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=File:Datapath.jpg&amp;diff=3893</id>
		<title>File:Datapath.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=File:Datapath.jpg&amp;diff=3893"/>
		<updated>2008-04-07T10:16:08Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: Theora on 353 simulation. Overview of the data path from the sensor to the dma output. No more data after channel 7 of the memory controller.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Theora on 353 simulation. Overview of the data path from the sensor to the dma output. No more data after channel 7 of the memory controller.&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3718</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3718"/>
		<updated>2008-04-02T14:37:36Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* System interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3717</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3717"/>
		<updated>2008-04-02T14:37:18Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* System interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; ||	da_table_a0 || write gamma table address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; ||	twr0 || write gamma table data&lt;br /&gt;
| -&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3755</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3755"/>
		<updated>2008-03-31T08:37:38Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a question concerning the sensor in both 333 and 353 design. In the 333 the sensor has a 10 bit output that goes directly to the sensorpix module (through sensorpads) to a 10 bit input. However In the 353, the sensor has a 12 bit output that goes to the sensorpads module and is treated to produce a 16 bit output that goes to the sensorpix module. What is the purpose of the extra bits in the 353 design ? Is it possible to extract a 10 bit output from the 353 sensorpad module to feed a 333 sensorpix block ? It looks like that the higher 10 bits of the ipxd[15:0] signal are different from the lower 6 bits (the latter can be forced to 0 with the cnven signal). Are these 10 bits similar to the 10 bits output of the 333 sensor ? &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;sensorpads353.v&#039;&#039;&#039;&lt;br /&gt;
     ...&lt;br /&gt;
     ipxd_pre[ 5:0] &amp;lt;= cnven?6&#039;b0:{ipxded[3:2],pxd14?ipxded[1:0]:2&#039;h0,2&#039;h0};&lt;br /&gt;
     ipxd_pre[15:6] &amp;lt;= ipxded[15:6];&lt;br /&gt;
     ipxd[15:0] &amp;lt;= ipxd_pre[15:0];&lt;br /&gt;
     ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 03:37, 31 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3754</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3754"/>
		<updated>2008-03-27T08:32:18Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
Have you tried to increase &amp;quot;part_mem_bits&amp;quot;? It&#039;s in ddr_parameters.v&lt;br /&gt;
--[[User:Oleg|Oleg]] 20:06, 26 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
I defined FULL_MEM in ddr.v to be sure, there is no more memory overflow error. However is the simulation still representative of reality ? --[[User:JeremViewsurf|JeremViewsurf]] 03:32, 27 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3752</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3752"/>
		<updated>2008-03-26T16:46:54Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length  of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I checked the table programming (quantization, huffman, etc), the procedure seems ok. I finally have data output on the SDA and SDD ports after having replace the sensorpix and sensortrig blocks in the 353 with those that were in the 333 Theora (with some modifications in the width of some signals). However, the timings seems completely different between the two sensors and I experience memory overflow during the simulation :&lt;br /&gt;
&lt;br /&gt;
 ...&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Row = 0034, Col = 06d, Data = 0000&lt;br /&gt;
 At time 1498748.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06d with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 At time 1498748.000 ns WRITE: Bank = 3, Col = 070&lt;br /&gt;
 At time 1498752.000 ns WRITE: Bank = 3, Row = 0034, Col = 06e, Data = 0000&lt;br /&gt;
 At time 1498752.000 ns ERROR: Memory overflow.&lt;br /&gt;
   Write to Address 180d06e with Data 0000 will be lost.&lt;br /&gt;
   You must increase the part_mem_bits parameter or define FULL_MEM.&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 11:46, 26 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3716</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3716"/>
		<updated>2008-03-21T08:49:21Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Hardware updates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
[[Image:Schematic.png|frame|[[Media:Schematic.png|333 Theora design with the 2 stage compressor and the 8-channel memory controller]]]]&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8 channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3751</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3751"/>
		<updated>2008-03-19T10:20:52Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some news concerning the simulation of Theora on the 353 :&lt;br /&gt;
* I instantiated the x353t module with the sensor and the sdram.&lt;br /&gt;
* I&#039;m trying to go through the initialization sequence&lt;br /&gt;
* The global initialization works (with glbl.v)&lt;br /&gt;
* The DCM reset works (SDRAM clocks SDCLK_D and SDNCLK_D are working)&lt;br /&gt;
* I didn&#039;t check if the tables programmation is ok yet&lt;br /&gt;
* The sdram initialization sequence works :&lt;br /&gt;
&lt;br /&gt;
 Initialize SDRAM&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214455.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 214556.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214605.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00002002)&lt;br /&gt;
 At time 214708.000 ns EMR  : Extended Mode Register&lt;br /&gt;
 At time 214708.000 ns EMR  : Enable DLL&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214755.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000163)&lt;br /&gt;
 At time 214860.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 214860.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 214860.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 214905.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00017fff)&lt;br /&gt;
 At time 215004.000 ns PRE  : Addr[10] = 1, Bank = 11&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215055.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215156.000 ns AREF : Auto Refresh&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215205.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00008000)&lt;br /&gt;
 At time 215308.000 ns AREF : Auto Refresh&lt;br /&gt;
 testbench353t.i_mt46v16m16fg: at time 215308.000 ns MEMORY:  Power Up and Initialization Sequence is complete&lt;br /&gt;
 &lt;br /&gt;
 &amp;gt;&amp;gt; 215355.000 ns &amp;gt;&amp;gt; cpu_wr(21, 00000063)&lt;br /&gt;
 At time 215460.000 ns LMR  : Load Mode Register&lt;br /&gt;
 At time 215460.000 ns LMR  : Burst Length = 8&lt;br /&gt;
 At time 215460.000 ns LMR  : CAS Latency = 2.5&lt;br /&gt;
 &lt;br /&gt;
 Initialize SDRAM done&lt;br /&gt;
&lt;br /&gt;
I committed the changes to the CVS. --[[User:JeremViewsurf|JeremViewsurf]] 05:20, 19 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3750</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3750"/>
		<updated>2008-03-11T14:22:20Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;br /&gt;
&lt;br /&gt;
The source code is now available on the Elphel CVS : [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ | http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]. The synthesis of this code is OK but it still have to be tested. I split the testbench between the main simulation sequence and the different tasks. The x353_sim.sh script is up to date but the simulation itself (x353_1.tf) is inadequate to test the design (it is still the old MJPEG testbench). The testbench in the 6.3.9 firmware (333 Theora) seems to fit better but I still need to know how it works precisely in order to adapt it to the 353 design. --[[User:JeremViewsurf|JeremViewsurf]] 09:22, 11 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3715</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3715"/>
		<updated>2008-03-11T13:18:39Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3714</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3714"/>
		<updated>2008-03-11T13:18:05Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
The source code of this project is available at [http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/]&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3713</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3713"/>
		<updated>2008-03-11T13:17:28Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://elphel.cvs.sourceforge.net/elphel/fpga/theora_353/ 353 Theora CVS]&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3749</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3749"/>
		<updated>2008-03-10T15:45:50Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3748</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3748"/>
		<updated>2008-03-10T15:45:31Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I&#039;m working on the simulation of the 333 Theora design (x333t.tf) and it looks like there are three simulation modes for this design that can be switched with &#039;define : MASTERMODE, MASTERMODE1,SINGLE_ST. What is the difference between these modes and how does each work in summary ? --[[User:JeremViewsurf|JeremViewsurf]] 10:45, 10 March 2008 (CDT)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3712</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3712"/>
		<updated>2008-03-07T10:31:03Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Control register */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! Signal || Destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || cb_bayer_phase || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; ||  || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || cb_fillfactory || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || cb_dlyhact || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || cb_zoran || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || cb_skipline || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || cb_xt_pol || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || iarst || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || iaro || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || cb_encnvclk || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || cb_sensor_trigger || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || imrst || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || cb_scl0_o || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || cb_scl0_o || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || cb_scl0_en || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || cb_sda0_o || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || cb_sda0_en || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || cb_dclkmode || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || cb_pxd14 || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || cb_latehact || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || cb_pclksrc || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; ||  || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3711</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3711"/>
		<updated>2008-03-06T10:59:52Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* System interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjta0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3747</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3747"/>
		<updated>2008-03-06T09:17:57Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3746</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3746"/>
		<updated>2008-03-06T09:13:25Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
The later 353 software also has 2 I2C channels, similar to 333. One channel is designed to communicate to the sensor (and goes through 30-pin flex cable), the other - to additional boards that sit on top of the 353, that I2C bus uses 2 bits (0,1) of the 12-bit GPIO of the 353 FPGA. It is currently used by multiple I2C peripherals on teh 10369 board (IDE bus configuration, clock/calendar, temperature sensor/fan control, EEPROM, USB hub configuration --[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
&lt;br /&gt;
When simulating Theora I used Silos III simulator on Windows, some work is needed to make it work with Icarus. First step - patch Xilinx unisim library, then - go through code (maybe it needs width for sd1?. The other problem that will come out - in Silos tasks were reenterable, each instance having it&#039;s own set of local variables (I used it when simulating CPU interrupts), in Icarus - they all share the same.--[[User:Andrey.filippov|Andrey.filippov]] 12:27, 5 March 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
I fixed the previous compilation error in Icarus, in channel0.v and channel1.v replace &lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+1&lt;br /&gt;
&lt;br /&gt;
with &lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+4&#039;h1&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+11&#039;h1&lt;br /&gt;
&lt;br /&gt;
I can finally visualize some chronograms in gtkwave however I&#039;m using the old 353 testbench... Time to understand how the testbench is structured and to think about a smarter one to test the new design. --[[User:JeremViewsurf|JeremViewsurf]] 03:13, 6 March 2008 (CST)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3743</id>
		<title>Talk:Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Talk:Porting_Theora_to_353_cameras&amp;diff=3743"/>
		<updated>2008-03-05T14:57:50Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ok, I started a new page on the Theora project in 353 cameras. I started with a global approach and a list of modules that need to be changed or replaced on the 353 model. Feel free to correct me or add suggestions as I&#039;m not (yet...) an expert on Elphel cameras. I think the first step is to make an exhaustive list of the hardware blocks that need modifications and then detail what need to be done in each block. --[[User:JeremViewsurf|JeremViewsurf]] 03:48, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As I understand your first need is not a streaming but producing a small video clip to be uploaded via FTP. This can be done more easy with minimal non FPGA modifications.&lt;br /&gt;
&lt;br /&gt;
We will probably create a CVS branch for your port, to be able to test it we need to compile a standard 7.1.x firmware disabling everything sensor or FPGA related and change the FPGA bitstream. --[[User:Polto|Alexandre.Poltorak]] 07:53, 19 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You mean that it should be possible that the system can handle software Ogg Theora encoding for a non real-time application such as producing small video clips ? I&#039;m aware that it depends on the output resolution, framerate and length of the clip but does a 1 min 1024x768 @ 25fps clip for example can be processed in a reasonable delay ? I&#039;ll discuss with Viewsurf&#039;s development team in order to obtain more precise specs concerning video output (in terms of length, resolution, framerate and encoding delay acceptable) but if you can give me an idea of what the software part can handle, I would consider spending more time in soft Theora transcoding instead of FPGA design. --[[User:JeremViewsurf|JeremViewsurf]] 03:37, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, sorry i was not speaking of transcoding. It would take too much calculation power and is not possible on the camera&#039;s CPU. The Theora encoding should be done in FPGA. What i was speaking about is the software part.. I think you do not need a streamer for the first steps. You only need to generate a clip in the FPGA memory, and upload it to a FTP. --[[User:Polto|Alexandre.Poltorak]] 08:32, 20 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some questions concerning changes in the FPGA :&lt;br /&gt;
* Is it necessary to keep histogram and timestamp blocks in a design which supports Theora only ?&lt;br /&gt;
** I believe the camera will be rather crippled w/o those features--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Is it possible to keep channel 0, 1 and 3 design without changes in the memory controller ?&lt;br /&gt;
** Theora implementation used different (more advanced) memory controller that the JPEG, it was getting 95% efficiency at Theora data structure, so you need Theora memory controller. But if you mean by &amp;quot;Channel 0 design&amp;quot; the gamma tables and histograms - yes, they probably could be ported (with some changes, of course). As for channels 1 and 3 - similar are available in Theora 333 also--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* The 353 design uses 2 DMA fifos between the compressor and the system interface instead of one in the 333 design. Is it possible to keep only one 333 DMA fifo in the final design ?&lt;br /&gt;
** Yes, of course - but this is so minor difference. The more important is that in Theora that FIFO could make the compressor wait if ETRAX DMA is not ready - at the beginning of the frame in theora there is a data &amp;quot;burst&amp;quot;.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* In the 353 design, all signals and blocks I/O concerning 90° phase clock are commented. Is it possible to uncomment them in order to restore the clock ? &lt;br /&gt;
** Maybe yes, more likely no. 353 and 333 use different FPGAs.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
* Motion compensation seems not to be implemented in the Theora compressor yet. Is it possible to add this feature later in the compressor block without major changes in the final design ?&lt;br /&gt;
** No, I&#039;m afraid that is not possible - I believe we need faster FPGA for that and likely faster/wider memory.--[[User:Andrey.filippov|Andrey.filippov]] 10:24, 25 February 2008 (CST)&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 02:43, 25 February 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I&#039;m currently working on the FPGA control register and I have a question concerning the I2C pads controlled by the control register (via dcr[16:21]). In the 333 design there are 2 I2C &amp;quot;channels&amp;quot; : (sda0,scl0) and (sda1,scl1) and only one on the 353 design. Is it possible to keep a single i2c channel on the new design ? In other ways, what is the purpose of the i2c &amp;quot;channels&amp;quot; in each device ? --[[User:JeremViewsurf|JeremViewsurf]] 03:19, 3 March 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to implement the new design according to the specs I proposed on this article. I instantiated the Theora compressor and the 8-channel memory controller in the place of the former jpeg compressor and memory controller and adapted registers and addresses (see article). The synthesis of this design with ISE is completed without error but I expect more issues with the place &amp;amp; route procedure. It would be great if I could share this work on a CVS to have some critics and some support, we had a discussion about that with Alexandre but I&#039;m still waiting for an account. Before going farther, I&#039;m trying to run the simulation with Icarus but  I&#039;m experiencing some issues with the compilation :&lt;br /&gt;
&lt;br /&gt;
 channel0.v:154: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
 channel1.v:152: error: operand of concatenation has indefinite width: (ntile_x[3:0])+(&#039;sd1)&lt;br /&gt;
 channel1.v:155: error: operand of concatenation has indefinite width: ({1&#039;b0, ntile_y[9:0]})+(&#039;sd1)&lt;br /&gt;
&lt;br /&gt;
I would appreciate some support concerning how to test and debug the new design since this seems to be a tough issue to deal with.&lt;br /&gt;
--[[User:JeremViewsurf|JeremViewsurf]] 08:57, 5 March 2008 (CST)&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3710</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3710"/>
		<updated>2008-03-05T14:23:21Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* 353 Theora new design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
&lt;br /&gt;
=== Sensorpix ===&lt;br /&gt;
&lt;br /&gt;
Some changes have to be done in this block to interface the sensor and the memory controller (ch0 and 1).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0 || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || twr_gamma || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3709</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3709"/>
		<updated>2008-03-05T14:14:27Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Control register */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0 || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || twr_gamma || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3708</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3708"/>
		<updated>2008-03-05T14:12:39Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* FPGA -&amp;gt; CPU data out MUX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0 || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || twr_gamma || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0] || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || &#039;&#039;&#039;x&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} || TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
	<entry>
		<id>https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3707</id>
		<title>Porting Theora to 353 cameras</title>
		<link rel="alternate" type="text/html" href="https://wiki.elphel.com/index.php?title=Porting_Theora_to_353_cameras&amp;diff=3707"/>
		<updated>2008-03-05T13:58:44Z</updated>

		<summary type="html">&lt;p&gt;JeremViewsurf: /* Internal registers MUX and status register */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Elphel model 333 cameras were able to encode and stream Ogg Theora with 6.3.9 firmware. However, this model is no longer produced by Elphel. The goal of this project is to use the full potential of 353 cameras (larger FPGA, faster CPU) in order to port the Ogg Theora feature on the new hardware. First, the camera should be able to upload small Theora clips via FTP.&lt;br /&gt;
&lt;br /&gt;
Different solutions are possible as previously mentioned in the [[Theora]] page :&lt;br /&gt;
* Instantiate both the Theora compressor and the MJPEG compressor in the FPGA since the new Spartan 3E seems to be large enough to handle the two features.&lt;br /&gt;
* Replace the existing MJPEG compressor with the Theora compressor and implement software Theora to JPEG conversion if JPEG is needed.&lt;br /&gt;
* Replace the existing MJPEG compressor in the 353 camera with the Theora compressor and keep two configuration files on the camera filesystem (one for Theora the other for MJPEG). FPGA code could be changed at run-time according to the needs.&lt;br /&gt;
&lt;br /&gt;
Dealing with the last solution seems to be a good start for this project as the other features mentioned can be added later. In all cases, both FPGA code and software code will need to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hardware updates ==&lt;br /&gt;
&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
Replace the MJPEG compressor in the 353 with the 333 Theora compressor ([http://elphel.cvs.sourceforge.net/elphel/camera333/fpga/x333 333 Theora FPGA code]). Maybe some adaptations need to be done within the Theora compressor itself. However, assuming that the compressor worked in 333 cameras a simple instantiation should suffice.&lt;br /&gt;
&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
Replace the 4-channel memory controller with an 8-channel memory interface as in the 333 model in order to handle Theora specific data.&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! 333 Theora !! 353 &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM || Data from the sensor (it can be combined with FPN correction data) to the SDRAM in either 8-bit mode or 16-bit&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module || Reads FPN data from SDRAM (8bit - subtract, 8 bit - scale) and feeds it to FPGA for FPN correction of the data on the way from sensor to SDRAM (through channel 0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor || Provides data to JPEG encoder in 16x16x8bit MCUs. It can also provide data directly to CPU through DMA bypassing any compression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data || Provides bidirectional access from CPU through 8x32 bit window.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63] || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || reading 12-bit pre-tokens from SDRAM in indexed coded order || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sensor interface ===&lt;br /&gt;
&#039;&#039;sensorpix&#039;&#039; block must be adapted in order to provide a coherent interface between the memory controller and the sensor (channels 0 and 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== System Interface ===&lt;br /&gt;
Adapt the system interface to assure communication between FPGA and its environment.&lt;br /&gt;
&lt;br /&gt;
A feature of the system interface is to establish communication between the system CPU and the different blocks within the FPGA (compressor, memory controller etc). This is done by selecting a block with the address bus &#039;&#039;a[12:0]&#039;&#039; connected to the internal address bus &#039;&#039;ial[7:0]&#039;&#039;:&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 always @ (posedge cwr) begin&lt;br /&gt;
    a0[7:0]&amp;lt;=ial[7:0];  // may want to change to just ia if ia will be late enough;&lt;br /&gt;
    wnr0                &amp;lt;= ~irnw;&lt;br /&gt;
    da_ctl0             &amp;lt;= (ial[7:0]==8&#039;h00);  // 0x00 WE to control 32-bit register (1 loc)&lt;br /&gt;
    da_dmamode0         &amp;lt;= (ial[7:0]==8&#039;h01);  // 0x01 select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
    da_sensormode0      &amp;lt;= (ial[7:0]==8&#039;h02);  // 0x02 select writing to sensorpix (1 loc)&lt;br /&gt;
    ...&lt;br /&gt;
    da_compressor0      &amp;lt;= (ial[7:1]==7&#039;h06);  // 0x0c..0x0d - will be farther decoded in the compressor module&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
Since memory controller and compressor are to be replaced these addresses have to be adapted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x09&#039;&#039;&#039; || da_saturation0 || write color saturation values&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0c..0x0d&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0e&#039;&#039;&#039; || da_table_a0 || write tables address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0f&#039;&#039;&#039; || twr0 || write tables data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x2f&#039;&#039;&#039; || da_dswe0 || select reading/writing to mcontr (16 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 system interface address table&#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; &lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0 || write number of lines to be transferred in a frame (or aftre trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x06&#039;&#039;&#039; || da_interrupts0 ||  interrupt mask&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || da_debug || write 0x10 any - load debug shift, read (through cs4) -shift&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0  || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || da_table0  || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0  || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Addresses 0x01,2,3,4,5,6,8 and 0x30 can be kept in the 353 system interface. The interrupt mask address 0x06 in the 333 sys interface is no longer used (353 uses interrupt vectors). The Theora compressor and the new memory controller addresses have to be mapped again in the new design (addresses 0x0c..0x0d and 0x20 to 0x2f in the 353 sys interface).&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
Adapt the Theora compressor interrupts to the 353 interrupt vector .&lt;br /&gt;
&lt;br /&gt;
The 353 interrupt vector can handle up to 16 different irq. However, only irq 0 to 7 are used :&lt;br /&gt;
 &#039;&#039;&#039;x353.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 assign irq_in= {8&#039;b0,                    // extra&lt;br /&gt;
                compressor_done_compress, // 7 - will go high after all data is sent out (reset by compressor)&lt;br /&gt;
                compressor_done_input,    // 6 - will go high after EOT and persist until DCT is enabled (reset by compressor)&lt;br /&gt;
                dcc_rdy,                  // 5 - obsolete in 333 - channel3 has 128 more dc coefficients (or some if the compression is finished)&lt;br /&gt;
                compressor_eot,           // 4 - compressor read in the last MCU (predictable time to end of transfer)&lt;br /&gt;
                sr_sensortrig[2],         // 3 - (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
                xfer_over_irq,            // 2 - (sync to pclk) - frame acquisition over&lt;br /&gt;
                trig_irq,                 // 1 - (sync to pclk) - external trigger&lt;br /&gt;
                vacts};                   // 0 - (sync to pclk) - frame sync&lt;br /&gt;
&lt;br /&gt;
353 MJPEG compressor triggers irqs 4, 6 and 7. 333 Theora compressor is the source of two irqs :&lt;br /&gt;
 &#039;&#039;&#039;compressor_all.v&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
 done,           // single-cycle pulse when the compressed frame is sent out (IRQ source).&lt;br /&gt;
 reset_compress, // reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
&lt;br /&gt;
Adaptation should consist of assigning Theora compressor irq sources to vectors 6 and 7 for example if the MJPEG compressor is to be replaced.&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
353 design uses 2 DMA FIFOs between the compressor and the system interface instead of one for the 333 Theora compressor. The two DMA FIFOs have also slight differences between the two design. Maybe a single 333 FIFO should be kept for the final design (?)&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
The purpose of this MUX is to route data out from the different FPGA blocks to the system interface and then to the data bus to the CPU. The selection is made with the internal address bus &#039;&#039;ia&#039;&#039;. &lt;br /&gt;
                                   _&lt;br /&gt;
                                --| \&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |--- iod[31:0] -&amp;gt; to system interface&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                --|  |&lt;br /&gt;
                                  |_/&lt;br /&gt;
 from system interface -&amp;gt; ia[7:0]__|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Adress range !! ia(5) !! ia(4) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d[31:0]  || DMA data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,xfer_bytes[23:0]} || Frame length (in bytes)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel 3&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0.. (even)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || dma_d0[31:0] || DMA 0 data&lt;br /&gt;
|- &lt;br /&gt;
| &#039;&#039;&#039;0x0.. (odd)&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || dma_d1[31:0] || DMA 1 data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || rd_regs[31:0] || Data from internal registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || dsdo[31:0] || Data out from descriptor memory&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x3..&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || bdo[31:0] || 32-bit data from SDRAM channel3&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || hist_do[31:0] || Histogram data out, actully only [17:0]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {12&#039;h0,pio_usec[19:0]} || usec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x45&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || pio_sec[31:0] || sec output from RTC&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x6..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || 32&#039;h0 || 0x0000&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x7..&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || {14&#039;b0,xfpgatdo,xfpgastat,4&#039;b0,io_pins[11:0]} ||  TDO read from an external FPGA / Multiplexed read data from xjtag / Status of 12 i/o pins&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address || ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || {24&#039;b0,irqr[7:0]} || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 MUX &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(2) !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x14&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {8&#039;h0,imgptr[23:0]} || Image pointer in 32-byte chunks &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x15&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;X&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || hifreq[31:0] || Accumulated high-freq components&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 333 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_sda1 || I2C&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_scl1 || I2C clock1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4..12&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || itrig || TRIG input&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || dcm_err[1:0] ||  00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
, 01 - clock is too late&lt;br /&gt;
, 10 - clock is too early&lt;br /&gt;
, 11 - OK (some measurements show too late, some - too early)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || dcm_done ||&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || tok_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || debug_out || Debug shift register output&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || &#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; 353 status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C to sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || sr_ch0rdy || Ready to write next page (channel 0) SENSOR-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_ch1rdy || Ready to read next page  (channel 1) SDRAM-&amp;gt;FPN(SENSOR)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sr_ch2rdy || Ready to read next page  (channel 2) SDRAM-&amp;gt;DMA&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode). May reprogram channel3.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7..10&#039;&#039;&#039; || sr_nextFrame[3:0] || (level) generated before actual block is filled - needed to be combined with the pulse from buffer control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11..13&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || dcc_rdy || 128 of DC components from JPEG encoder are available (same as interrupt)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || compressor_done_input || will go high after EOT and persist until DCT is enabled&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || compressor_done_compress || will go high after all data is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19..18&#039;&#039;&#039; || dcm_err[1:0] || SDRAM DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || dcm_status[0] || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..23&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sens_dcm_status[0] || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29..30&#039;&#039;&#039; || clockios_status[1:0] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || 1&#039;b0 || 0x0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
The dcr[31:0] bus is used to control the different blocks according to the control register values. The control register can be directly written by the CPU at the address 0x00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;333 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0..2&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || iobuf || EXPS (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || i2cpads || scl1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || i2cpads || scl1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || i2cpads || sda1 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || i2cpads || sda1 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..27&#039;&#039;&#039; || clock_pclk || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || clk enable&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;353 control register&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || compressor || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || clock_pclk || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
* Looks like Theora compressor requires 90° phase clock that was abandoned in the 353 design.&lt;br /&gt;
Using different phases reduces AC component of the current through the power/ground lines of the FPGA by spreading register transitions. Theora has larger core so it may help spreading phases.--[[User:Andrey.filippov|Andrey.filippov]] 13:45, 25 February 2008 (CST)&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
== Software updates ==&lt;br /&gt;
&lt;br /&gt;
* Adapt FPGA definitions ([http://elphel.cvs.sourceforge.net/elphel/elphel353/elphel353/os/linux-2.6-tag--devboard-R2_01-1/arch/cris/arch-v32/drivers/elphel/x353.h?revision=1.8&amp;amp;view=markup&amp;amp;sortdir=down x353.h]) and most likely some other FPGA drivers.&lt;br /&gt;
* ...?&lt;br /&gt;
&lt;br /&gt;
These lists of update are obviously incomplete. They need to be more detailed in order to make an exhaustive list of the changes that have to be done.&lt;br /&gt;
&lt;br /&gt;
== 353 Theora new design ==&lt;br /&gt;
=== Compressor ===&lt;br /&gt;
=== Memory controller ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Channel !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || 8/16 bit data from sensor to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 16 bit data from SDRAM to FPN correction module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 20x20 tiles of raw data from SDRAM to the color space converter and compressor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || PIO read/write of SDRAM data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || Writing current (restored) frame as YCbCr 4:2:0 data to SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || Reading previous frame as YCbCr 4:2:0 data from SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || Writing 12-bit pre-tokens to SDRAM (in macroblock-scan order, starting with AC[63]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || Reading 12-bit pre-tokens from SDRAM in indexed coded order&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== System interface ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! da signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x00&#039;&#039;&#039; || da_ctl0 || WE to control 32-bit register (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x01&#039;&#039;&#039; || da_dmamode0 || select writing to dma_cntr/dma_raw (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x02&#039;&#039;&#039; || da_sensormode0 || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x03&#039;&#039;&#039; || da_virttrig0 || write virtual trigger threshold&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x04&#039;&#039;&#039; || da_sensortrig0  || select writing to sensorpix (1 loc)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x05&#039;&#039;&#039; || da_sensortrig_lines0  || write number of lines to be transferred in a frame (or after trigger)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x07&#039;&#039;&#039; || da_sens_dc0 || write to sensor DCDC converter frequency divider&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x08&#039;&#039;&#039; || da_dcm0 || tune SDRAM clock phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x0a&#039;&#039;&#039; || da_framesync_dly0 || write frame sync interrupt delay (in scan lines)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; ||  || Status register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1b&#039;&#039;&#039; || dcmrst || async signal to restart DCMs (if irnw=0)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x1c..0x1f&#039;&#039;&#039; || da_interrupts0 || interrupt control&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x20..0x27&#039;&#039;&#039; || da_mcontr0 || select reading/writing to mcontr (8 locations)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x28..0x2f&#039;&#039;&#039; || da_compressor0 || will be farther decoded in the compressor module&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x2c..0x2d&#039;&#039;&#039; || twr_gamma || write gamma tables address (same as in compressor)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x30&#039;&#039;&#039; || da_mem0 || read/write to SDRAM buffer, autoincrement address&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x40..0x43&#039;&#039;&#039; || da_hist0 || write/read histogram related data/registers&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x44..0x47&#039;&#039;&#039; || da_rtc0 || real time clock &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x48&#039;&#039;&#039; || da_timestamp0 || write timestamp mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x74&#039;&#039;&#039; || da_xjtag0 || write to external (sensor board) JTAG&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x78..0x7b&#039;&#039;&#039; || da_extsync0 || control of external sync module 0x78 - 0x7b&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Interrupts ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! irq_in !! Signal !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15..8&#039;&#039;&#039; || GND || Extra&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || compressor_done_compress || single-cycle pulse when the compressed frame is sent out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || compressor_reset_compress || reset compressor done interrupt (writing any compressor command)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || GND || dcc_rdy was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || GND || eot irq was tied to GND in the 333 design &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sr_sensortrig[2] || (sync to pclk) - level, reset by writing to sensor triggering command register&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || xfer_over_irq || (sync to pclk) - frame acquisition over&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || trig_irq || (sync to pclk) - external trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || vacts || (sync to pclk) - frame sync&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== DMA FIFOs ===&lt;br /&gt;
A single DMA FIFO from the 333 design will be instanciated.&lt;br /&gt;
&lt;br /&gt;
=== FPGA -&amp;gt; CPU data out MUX ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(6) !! ia(5) !! ia(4) !! ia(2) !! ia(0) !! iod[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| ||  ||  ||  ||  ||  ||  || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Internal registers MUX and status register ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Address !! ia(1) !! ia(0) !! rd_regs[31:0] !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x10&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || Status register || See below&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x11&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || irqr[31:0] || Interrupts&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x12&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;0&#039;&#039;&#039; || {5&#039;b0,trig_v[10:0],4&#039;b0,trig_h[11:0]} || Trigger phase&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0x13&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || &#039;&#039;&#039;1&#039;&#039;&#039; || MODELREV || Model revision&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; Status register &#039;&#039;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! Bit # !! Signal !! Comments &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || sr_sda0 || I2C data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || sr_scl0 || I2C clock&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2..10&#039;&#039;&#039; || rq_busy[8:0] || Request or busy - per mcontr channel&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sr_memrdy || Ready to r/w next 8x32 page (channel 3) CPU&amp;lt;-&amp;gt;SDRAM&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sr_wrempty || CPU write buffer empty (valid only in write mode)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13..15&#039;&#039;&#039; || sr_sensortrig[2:0] || x00 - idle, x01 - waiting vacts to start, x10 - waiting for trigger, x11 - frame over ,1xx - frame done (reset by writing command to sensor_trig&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || dma_empty || dma output buffer empty and dma is enabled (pessimistic - with delay)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17..18&#039;&#039;&#039; || dcm_err[1:0] || 00 - no data (SDRAM reads) since last change (wclk*wcmd)&lt;br /&gt;
&lt;br /&gt;
, 01 - clock is too late , 10 - clock is too early , 11 - OK (some measurements show too late, some - too early) &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || dcm_done || SDRAM DCM cmd (inc/dec) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || dcm_locked || SDRAM DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sens_ph_err[1:0] || Sensor DCM phase error&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || sens_dcm_done || Sensor DCM cmd (inc/dec/reset) done&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || sens_dcm_locked || Sensor DCM overflow&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || clockios_locked || dcm locked&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;26&#039;&#039;&#039; || clockios_status[1] || dcm status (bit 1 - dcm clkin stopped)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;27&#039;&#039;&#039; || sr_pipe_rdy || Will go active with delay to overlap with DMA busy (external)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28&#039;&#039;&#039; || sr_pipe_nempty || Compressor pipe not empty (updated with done -&amp;gt; IRQ)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;29&#039;&#039;&#039; || sr_pipe_full || Compressor pipe has 3 frame compress commands in the input queue/in progress&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;30&#039;&#039;&#039; || en_refresh || Status bit to find out if SDRAM is programmed&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || took_frame_num_wr || Odd/even frame of tokens written&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Control register ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! bit # !! destination block !! Comments  &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;0&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1..2&#039;&#039;&#039; || compressor, sensorpix, histogram || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || sensorpads || Inverts idclk phase (Not used)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || sensorpads || fillfactory sensor mode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || sensorpads || delay hact pulse by 1&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || sensorpads || &#039;&#039;cb_zoran&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || sensorpads || skip first scan line from the sensor&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || sensortrig || external trigger polarity (0: 1-&amp;gt;0, 1: 0-&amp;gt;1)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || sensorpads || &#039;&#039;iarst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || sensorpads || &#039;&#039;iaro&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || sensorpads || 0 - use 12-bit sensor data, 1 - use converter output pins&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || sensorpads || sensor trigger&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || sensorpads || &#039;&#039;imrst&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || iobuf || XRST (output pin)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || i2cpads || scl0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || i2cpads || scl0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || i2cpads || sda0 out&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || i2cpads || sda0 enable&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || sensorpads || dclkmode&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || sensorpads || use {vact,hact} as 2 LSB in 14-bit data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21..22&#039;&#039;&#039; || sensorpads || register hact, vact, bpf N/4 Tpclk later than data&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24..25&#039;&#039;&#039; || BUFGMUX || pclk source&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;28..30&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;31&#039;&#039;&#039; || Not used || &lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Others ===&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[[Theora]]&lt;br /&gt;
*[[FPGA_Development_in_Elphel_cameras|FPGA Development in Elphel cameras]]&lt;br /&gt;
*[[Design Ideas|FPGA Theora Encoder for Videoconferencing]]&lt;br /&gt;
*[[10353]]&lt;/div&gt;</summary>
		<author><name>JeremViewsurf</name></author>
	</entry>
</feed>