Hot answers tagged

23

If the compiler writers put some effort into optimizing it for that target, it will at least make some use of the special DSP instructions / architecture. But for ultimate performance it will never be as good as hand-tuned assembly. It might be plenty good enough, though - depends on your application. Other alternatives include: Write the majority of ...


21

See also FPGA's vs Microcontrollers High-speed image or video processing is a good example. Or processing 'images' that aren't straightforward optical images, such as radar or laser-based systems. The key thing to consider is throughput and latency requirements. A microcontroller can service an interrupt (very roughly) once per microsecond. It can ...


21

Premature optimization is the root of all evil. - Donald Knuth When you find that you don't get enough performance from your code, profile your program first, find the bottlenecks, analyze your performance requirements, and only then start doing optimizations. Writing assembly code is last resort. My question is if I just program in C, wouldn't the ...


20

It's always better to have your algorithm implemented in a higher-level language (which C is compared to assembly), even if you plan to implement everything in assembly in the end. chances are, you won't even need assembly. If the code generated by your compiler meets your design goals, your job is done. if not, you won't be starting your assembly coding ...


19

Taking a derivative (or an integral) is a linear operation — it doesn't create any frequencies that weren't in the original signal (or remove any), it just changes their relative levels. So the Nyquist rate for the derivative is the same as that for the original signal.


18

Your DSP will be advertised with a maximum sustained MACs, assuming all the pipes are filled. That is obviously an upper limit to what can be achieved. You know how many MACs your filters and other processing will take, from your analysis. Aim to have the first at least twice the second, as you will not be able to keep the DSP core running at maximum. Just ...


16

Well, I do real-time processing of HD video in FPGAs. Some of what I do could be done in a GPU chip, but not on a microcontroller or DSP. The FPGA is more flexible. Many systems combine FPGAs and MCUs/DSPs to get the best of both worlds. One project I may be working on soon involves object recognition in a video stream. The preliminary steps (noise removal, ...


14

In short, FPGAs are good where you need to perform a little processing on a lot of data, and CPUs are good where you need to perform a lot of processing on a little data. An HDMI video stream is a lot of data. It can be done by a CPU, GPU, or ASIC in the general video case, but if you need to do a little bit of work on it (add an overlay, for instance) you ...


12

Generally, you use a microcontroller when it can do the job. A microcontroller performs the logic by executing sequential instructions. A FPGA performs the logic because its hardware gates are logically wired to do so. That means it can do things much faster, and a number of such things at the same time. It is generally more complicated and difficult to ...


12

If you just want to multiply two numbers and they suit the DSP block then the * operator should infer a DSP block. If not, send the synthesis tool back :) However, to take advantage of the more complex combinations of the DSP functionality often requires a direct instantiation of the block and configuring of its parameters. Examples of things which may ...


11

I'm guessing you've encountered this in terms of PIC programming. PICs originally had I/O ports handled in a very direct manner - you could read what values they had externally, or write what values you output, both on the same address. The downside of this was that the value you were trying to output might not match the state on the pin - something else ...


11

uC = a stand-alone processing chip: CPU, RAM, ROM, some peripherals. DSP = processor chip (can be a separate CPU, nowadays mostly a uC) that is optimized for signal processing. Often has fast MAC (multiply-accumulate), saturating math, and multiple memory interfaces. To get the most out of it, you often need to be deeply aware of its peculiarities, like ...


11

Character generator ROMs with 5x7 ASCII codes were certainly sold. One example was the Signetics 2513, a rather nasty and sluggish P-MOS chip requiring three supply rails. OTP and UV-erasable EPROMs came along not so long after- so the cost advantages of mask ROMs were not as significant as compared to mask charges (mask ROMs are not really fully custom ...


10

Some of the advantages of a dsPIC over earlier-architecture PICs, like the PIC 16 and 18 families: 16 bit wide data paths and ALU, as apposed to 8. Ability to directly address (later versions of both architectures extended this in various kludgy ways) more data memory. A basic PIC 16 can address 128 bytes directly, 512 with banking. The newer PIC 16F1xxx ...


9

There is a lot of bad information and audio phoolery available on this topic, but if you're doing one channel of digital audio, 96kHz and 192kHz sample rates are silly. Human hearing extends to 20kHz. To satisfy Nyquist at 20kHz, we need a sampling rate greater than 40kHz. CDs are 44.1kHz, and 48kHz is another common sampling frequency. Now, let's recall ...


8

One application I have not seen mentioned yet is microelectronic engineering or the design of MCU/CPU/GPU/ASIC chips themselves. These chips are often prototyped by designing them in HDL and then implemented in an FPGA. This makes them easier, cheaper, and quicker to test and modify before finally using the HDL to create the layout needed for production of ...


8

You need to account for the ear by using the Fletcher Munsen curve (spelling may not be perfect but google will show the graph). Basically all sound levels for different frequencies have been empirically captured onto the graph.


8

No, transforms aren't "necessary", but they do make some types of calculations much simpler and more convenient. It is possible to do all computation and analisys of a signal in either the time domain or the frequency domain. However, some operations are much simpler and more intuitive in one than the other. This can be illustrated with something as ...


8

First, note that FIR/IIR is not the same as non-recurrent/recurrent (where recurrent means that the output depends on previous inputs and previous outputs). You can have a non-recurrent filter with infinite impulse response (e.g. \$h[n] = sinc(n/3)\$, which cannot be expressed as a recursion). And you can have a recursive construction for a FIR filter. But,...


8

I am not fond of encoding command data as an analog signal in a digital file. I think I would try something like encoding the lighting commands as text blocks in the lyrics block of the ID3 information inside the mp3 file. The lyrics block is before the sound data, so you should be able to decode it quickly before you start playback. Typical libraries for ...


7

Let's do some math: 16 tracks * 44 ksample/s *2 channels *16 bit = 22.528 Mbps This is the minimum speed you need for the SPI interface, if you want to transmit all the data through a single serial port. Can be done, with an adequate clock, but you need a fast SD card (see here for the speed). Then there is the microcontroller: you have to add 16 tracks ...


7

I'm afraid you're up against a fundamental limitation of real, causal physical systems. You're asking for a filter that can distinguish between signals that have periods of 12 to 16 seconds, but only allowing it to "look at" a 2-second segment (1/6 to 1/8 of the period) of the waveform in question. It simply isn't possible to get no phase shift and low delay ...


7

Usually, the key distinguishing feature of a DSP when compared with a general-purpose CPU is that the DSP can execute certain signal-processing operations with few, if any, CPU cycles wasted on instructions that do not compute results. One of the most basic operations in many key DSP algorithms is the MAC (multiply-accumulate) operation, which is the ...


7

It depends on who you ask. Most humans cannot hear beyond 20 kHz and 16 bits, so 96 or 192 kHz should be plenty. As for hearing a difference between 16 and 24 bit converters it depends on your DSP. The key benefit of 24 bit converters is it gives you tons of additional headroom (dynamic range) so you can do a lot of mathematical operations and not add ...


7

Even though I answered this question already, I will add another answer to illustrate a different viewpoint: Write in C, read in assembly! So, instead of writing in assembly, you will write the logic in C, carefully making sure that the assembler output of the C code is optimal. You can often do certain tricks on the C code to affect the assembler output. ...


6

Conversion from time domain to frequency domain on sight is nearly impossible. There are some facts that will help you get an idea, though. Fourier says that any periodic signal can be represented as a sum of sines, each with its own phase and amplitude. The frequencies are multiples of the fundamental frequency. So if you look at a periodic signal you know ...


6

The primary advantage of switched capacitor filters is that they can be easily implemented on an integrated circuit. You can get performance similar to an analog RC op-amp based filter using a switched capacitor topology, while avoiding the need for an ADC, DSP, and DAC on a chip. Switched capacitor circuits use capacitors and switches to emulate the ...


Only top voted, non community-wiki answers of a minimum length are eligible