Issue 280: EQ Answers

PROBLEM 1
What is the key difference between the following two C functions?

#define VOLTS_FULL_SCALE 5.000
#define KPA_PER_VOLT 100.0
#define KPA_THRESHOLD 200.0

/* adc_reading is a value between 0 and 1
 */
bool test_pressure (float adc_reading)
{
  float voltage = adc_reading * VOLTS_FULL_SCALE;
  float pressure = voltage * KPA_PER_VOLT;

  return pressure > KPA_THRESHOLD;
}

bool test_pressure2 (float adc_reading)
{
  float voltage_threshold = KPA_THRESHOLD / KPA_PER_VOLT;
  float adc_threshold = voltage_threshold / VOLTS_FULL_SCALE;

  return adc_reading > adc_threshold;
}

ANSWER 1
The first function, test_pressure(), converts the ADC reading to engineering units before making the threshold comparison. This is a direct, obvious way to implement such a function.

The second function, test_pressure2(), converts the threshold value to an equivalent ADC reading, so that the two can be compared directly.

The key difference is in performance. The first function requires that arithmetic be done on each reading before making the comparison. However, the calculations in the second function can all be performed at compile time, which means that the only run-time operation is the comparison itself.

PROBLEM 2
How many NAND gates would it take to implement the following translation table? There are five inputs and eight outputs. You may consider an inverter to be a one-input NAND gate.

Inputs Outputs
A B C D E   F G H I J K L M
1 1 1 1 1 0 0 0 0 1 1 1 1
0 1 1 1 1 0 0 0 0 0 0 1 1
0 0 1 1 1 0 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 0 0 1 1
0 0 0 0 1 1 0 0 0 1 1 1 1

 

ANSWER 2
First of all, note that there are really only four inputs and three unique outputs for this function, since input E is always 1 and outputs GHI are always 0. The only real outputs are F, plus the groups JK and LM.

Since the other 27 input combinations haven’t been specified, we can take the output values associated with all of them as “don’t care.”

The output F is simply the inversion of input C.

The output JK is high only when A is high or D is low.

The output LM is high except when B is low and C is high.

Therefore, the entire function can be realized with a total of five gates:

eq0641_fig1

PROBLEM 3
Quick history quiz: Who were the three companies who collaborated to create the initial standard for the Ethernet LAN?

ANSWER 3
The original 10-Mbps Ethernet standard was jointly developed by Digital Equipment Corp. (DEC), Intel, and Xerox. It was released in November 1980, and was commonly referred to as “DIX Ethernet.”

PROBLEM 4
What was the name of the wireless network protocol on which Ethernet was based? Where was it developed?

ANSWER 4
The multiple access with collision detection protocol that Ethernet uses was based on a radio protocol developed at the University of Hawaii. It was known as the “ALOHA protocol.”

Electrical Engineering Crossword (Issue 281)

The answers to Circuit Cellar’s December electronics engineering crossword puzzle are now available.

281-Crossword-key

Across

4. VENNDIAGRAM—Represents many relation possibilities [two words]
5. PERSISTRON—Produces a persistent display
9. CODOMAIN—A set that includes attainable values
12. HOMOPOLAR—Electrically symmetrical
13. TRUTHTABLE—Determines a complicated statement’s validity [two words]
17. POWERCAPPING—Controls either the instant or the average power consumption [two words]
18. MAGNETRON—The first form, invented in 1920, was a split-anode type
19. MAGNETICFLUX—F
20. TURINGCOMPLETE—The Z3 functional program-controlled computer, for example [two words]

Down

1. CHAOSCOMPUTERCLUB—Well-known European hacker association [three words]
2. LOGICLEVEL—When binary, it is high and low [two words]
3. LINEARINTERPOLATION—A simple, but inaccurate, way to convert A/D values into engineering units [two words]
6. SYNCHRONOUSCIRCUIT—A clock signal ensures this device’s parts are in parallel [two words]
7. BOARDBRINGUP—Design validation process [three words]
8. HORNERSRULE—An algorithm for any polynomial order [two words]
10. MEALY—This machine’s current state and inputs dictate its output values
11. SQUAREWAVE—It is produced by a binary logic device [two words]
14. THEREMIN—Its electronic signals can be amplified and sent to a loudspeaker
15. ABAMPERE—10 A
16. SCOPEPROBE—Connects test equipment to a DUT [two words]

CC281: Overcome Fear of Ethernet on an FPGA

As its name suggests, the appeal of an FPGA is that it is fully programmable. Instead of writing software, you design hardware blocks to quickly do what’s required of a digital design. This also enables you to reprogram an FPGA product in the field to fix problems “on the fly.”

But what if “you” are an individual electronics DIYer rather than an industrial designer? DIYers can find FPGAs daunting.

Issue281The December issue of Circuit Cellar issue should offer reassurance, at least on the topic of “UDP Streaming on an FPGA.” That’s the focus of Steffen Mauch’s article for our Programmable Logic issue (p. 20).

Ethernet on an FPGA has several applications. For example, it can be used to stream measured signals to a computer for analysis or to connect a camera (via Camera Link) to an FPGA to transmit images to a computer.

Nonetheless, Mauch says, “most novices who start to develop FPGA solutions are afraid to use Ethernet or DDR-SDRAM on their boards because they fear the resulting complexity.” Also, DIYers don’t have the necessary IP core licenses, which are costly and often carry restrictions.

Mauch’s UDP monitor project avoids such costs and restrictions by using a free implementation of an Ethernet-streaming device based on a Xilinx Spartan-6 LX FPGA. His article explains how to use OpenCores’s open-source tri-mode MAC implementation and stream UDP packets with VHDL over Ethernet.

Mauch is not the only writer offering insights into FPGAs. For more advanced FPGA enthusiasts, columnist Colin O’Flynn discusses hardware co-simulation (HCS), which enables the software simulation of a design to be offloaded to an FPGA. This approach significantly shortens the time needed for adequate simulation of a new product and ensures that a design is actually working in hardware (p. 52).

This Circuit Cellar issue offers a number of interesting topics in addition to programmable logic. For example, you’ll find a comprehensive overview of the latest in memory technologies, advice on choosing a flash file system for your embedded Linux system, a comparison of amplifier classes, and much more.

Mary Wilson
editor@circuitcellar.com

DSP vs. RISC Processors (EE Tip #110)

There are a few fundamental differences between DSP and RISC processors. One difference has to do with arithmetic. In the analog domain, saturation, or clipping, isn’t recommended. But it generally comes with a design when, for example, an op-amp is driven high with an input signal. In the digital domain, saturation should be prevented because it causes distortion of the signal being analyzed. But some saturation is better than overflow or wrap-around. Generally speaking, a RISC processor will not saturate, but a DSP will. This is an important feature if you want to do signal processing.

Let’s take a look at an example. Consider a 16-bit processor working with unsigned numbers. The minimum value that can be represented is 0 (0×0000), and the maximum is 65535 (0xFFFF). Compute:

out = 2 × x

where x is an input value (or an intermediate value in a series of calculations). With a generic processor, you’re in trouble when x is greater than 32767.

If x = 33000 (0x80E8), the result is out = 66000 (0x101D0). Because this value can’t be represented with 16 bits, the out = 2 × x processor will truncate the value:

out = 2 × 333000 = 464(0x01D0)

From that point on, all the calculations will be off. On the other end, a DSP (or an arithmetic unit with saturation) will saturate the value to its maximum (or minimum) capability:

out = 2 × 333000 = 65535(0xFFFF)

In the first case, looking at out, it would be wrong to assume that x is a small value. With saturation, the out is still incorrect, although it accurately shows that the input is a large number. Trends in the signal can be tracked with saturation. If the saturation isn’t severe (affecting only a few samples), the signal might be demodulated correctly.

Generic RISC processors like the NXP (Philips) LPC2138 don’t have a saturation function, so it’s important to ensure that the input values or the size of the variable are scaled correctly to prevent overflow. This problem can be avoided with a thorough simulation process.—Circuit Cellar 190, Bernard Debbasch, “ARM-Based Modern Answering Machine,” 2006.

This piece originally appeared in Circuit Cellar 190, 2006. 

Electrical Engineering Crossword (Issue 280)

The answers to Circuit Cellar’s November electronics engineering crossword puzzle are now available.

280-crossword-key

Across

2.    DOPPLERLIMIT—Temperature restrictions for laser cooling techniques [two words]
4.    PINKNOISE—This signal sees the world through rose-colored glasses [two words]
5.    BOLTZMANNCONSTANT—k or kB [two words]
7.    XORGATE—A half adder is made of an AND gate and one of these [two words]
14.    NEPER—Symbolized by “Np”
15.    GOTOPAIR—Two tunnel diodes used in high-speed gate circuits [two words]
17.    YAGI—Unidirectional antenna
18.    PHOSPHOR—Used as a light source in a cathode ray tube
19.    KERREFFECT—All materials show this, but certain liquids display it more strongly than others [two words]

Down

1.    WEINBRIDGEOSCILLATOR—This type generates sine waves [three words]
3.    INTEGRATEDINJECTIONLOGIC—These digital circuits are built with several collector BJTs [three words]
6.    CARBONNANOTUBES—Their electronic properties can be metallic or semiconducting [two words]
8.    GILBERTCIRCUIT—Uses diodes and transistors’ logarithmic properties to compensates for nonlinearities and instabilities [two words]
9.    ADDRESSINGMODE—Can be implied by the instruction’s function [two words]
10.    SINADRATIO—Used to measure a signal’s standards
11.    FLATPACK—Semiconductor network sealed in a thin rectangular package
12.    SPEECHCLIPPING—Process that limits peak signals [two words]
13.    COMPANDOR—Condenses or enlarges an electric signal’s dynamic range
15.    GLASS—Device under development by search engine giant
16.    LILLIPUTIAN—A very small robot