Friday, February 19, 2010

FPGA : Sacrificing resource sharing for better timing

When it comes to any system design, the most important part is the optimum utilization of the available resources. Talking of system design with FPGAs, the resources mean the PLLs(Phase Locked Loop), RIOs(Rocket IOs), DCMs(Digital Clock Manager), BUFGs(Global Buffers), FFs(Flip-Flops), LUTs(Look Up Tables) and dedicated block rams.

There are numerous vendors supplying FPGAs in the market like Xilinx, Altera, Lattice, etc. All these vendors supply a wide range of FPGAs. Suitable FPGA should be selected depending upon the system resources required for your design and the resources available in the FPGA.

After the synthesisable code describing the system has been written, generating FPGA build takes two major steps. First, the code must fit the device selected and secondly, the design must meet the timing constraints (set up time, hold time, period constraints).

Most of the tools used to make FPGA builds available these days try to optimise the code and try to fit it in the device taking as less resources as it can. One of the logic used for optimising code is Resource Sharing.

Resource sharing is a technique where multiple logic blocks of the designed system share a common logic block. Let us take an example of a system which can add and subtract two input bits. The system can be thus divided into two major blocks of Addition of these two bits would give a bit each of Sum and Carry. Meanwhile, a subtractor would have a bit each of Difference and Borrow as its outputs. As we write the truth table we see that the sum and difference outputs have same logic design. If we try to make FPGA build with the code describing the above mentioned logic, the tool will infer only one logic block for generation of output difference and sum, i.e A XOR B (where A and B are input bits). And the tool will also try to place this block in the FPGA which will be equidistant from the outputs sum and difference.




This sharing of A XOR B block by the adder and subtractor block is known as resource sharing. This leads to optimum resource(FFs and LUTs) utilisation.

Referring to the above figure, we can see that if two logic blocks of A XOR B were generated, one each for sum and difference, the tool would have tried to place these two blocks as following:



When we are designing the system for lower speed(lower clock), then resource sharing is the best way to go. But, when we are working at higher speed where the timing is of utmost importance while placing the blocks in the FPGA, we have to take decisions of whether to use resource sharing or not. If the timing constraints for all the clocks used are met and the system is fitting in the device, then all is well. If the fitting issues arise, then we may have to enable resource sharing(by default the tools enable this feature). If we have design fitting handsomely but with problems meeting the timing constraints, then we may have to disable the resource sharing option. This would mean using up more resources but we would be rewarded with better timings. See the design for adder plus subtractor system in figures 1.1 with resource sharing and 1.2 without resource sharing. Obviously, the figure 1.1 uses lesser resources. But, when we calculate the total path delay from A and B to outputs Sum and Difference in the two designs, we will have to conclude that without resource sharing, we are achieving better timing in terms of path delays.

Now, consider the adder plus subtractor design to be a part of a bigger design, where the inputs A and B are outputs of Flip-Flops and the outputs Sum and Difference are inputs to different Flip-Flops. Using the design represented in figure 1.2 would lead to better margins in terms of setup times and the maximum clock speed that can be used in the design.

This way, sacrificing resource sharing can lead to better timing achievements.

Sunday, February 14, 2010

Inefficient cooling system design in Inspiron 1525


For a couple of months, I had a problem with my Inspiron 1525 shutting down in the middle of nowhere. For some time it wasn't a very serious problem, so I just let it do all its mischief. Then, a week ago I started playing Counter-Strike. The problem repeated like anything. After every ten minutes or so, the laptop shut down. Then I thought, enough is enough I have got to find out a solution.

Ten minutes of googling led me to find a solution, thanks to Andreas .The problem was due to inefficient cooling system design in the Inspiron 1525.

The cooling system consists of a heat transfer system, which transfers heat from the processor to the sink, fan and heat sink. The sink then radiates the heat out of the laptop. The affect of radiator(heat sink) is enhanced by the fan which helps to keep the heat sink cooler. If the fan doesn't work or the heat sink can't get the effect of fan, then the sink can't radiate the heat efficiently, and thus the temperature of CPU rises causing the computer to shut down.

The problem with my laptop was that there was dirt in between the heat sink and the fan. This meant the heat sink couldn't get the proper air-flow to cool it. The result, the heat sink wasn't functioning up to its optimum level and thus the processor was getting heated. This led to my computer getting shut down repeatedly.

The solution was to remove the dirt that lied in between the fan and the heat sink.

This is something I have to do every 2-3 months. But, this could have been avoided if the cooling system had been designed in a much better way. In the above paragraph, I have described about the parts of a cooling system. There is one thing missing. And that is a filter. Basically, when the fan is operating, it takes in air from some place (some vents) and then blows the air towards the heat sink. As the name suggests, the filter filters the air coming to the fan through these vents. The result is that the air flowing from the fan to heat sink is dirt free. Thus, there is no way dust can accumulate in between the fan and heat sink.


The filter system in the laptop seems to be absent which led to occurrence of this problem. I don't know if they didn't add filter to the cooling system design for some advanced reasons or they just forgot.