home *** CD-ROM | disk | FTP | other *** search
- SINE WAVE CONVERTER
-
- This map generates logic for a binary to sin-wave converter, for
- example for a digital power inverter. A counter external to the logic
- generates step numbers that run 0, 1, 2, ..., 254, 255, 0. Given the step
- number n, the logic consider it to represent an angle of (n/256)*360
- degrees, and computes the trigonometric sin of the angle (see Chapter 12
- of the reference guide for a description of the function isin). The
- result is presented in 8 bits of precision according to the following
- twos-complement encoding.
-
- Binary Decimal Rational Decimal
- Value Value Fraction Fraction
-
- 01111111b 127 127/127 1.0
- 01111110b 126 126/127 .99212598...
- : : : .
- 00000001b 1 1/127 .00787401...
- 00000000b 0 0 .0
- 11111111b -1 -1/127 -.00787401...
- : : : .
- 10000010b -126 -126/127 .99212598...
- 10000001b -127 -127/127 1.0
-
- Because this logic has eight input bits and eight output bits, it
- requires at least a 256 x 8 PROM (the logic is too complex to fit in a
- PAL). The input signals become address lines, with high-order bit first.
- The output signals become data lines, also with high-order bit first.
-
- |PROM256B8 in:STEP[7..0], out:SIN[7..0]
- |
- | Map: STEP[7..0] -> SIN[7..0] { n -> isin(n, 256, 127) }
- |
- | Vectors:
- | { Display "127 * sin(", (STEP[7..0])d, "/256) = ", (SIN[7..0])d
- | Test STEP[7..0]
- | End }
-
-
- VECTORS can test the logic in a PROM, but there is no provision in the
- hexadecimal format for the test vectors themselves. Therefore, with PROMs,
- VECTORS is used only as a logic simulator.
-
-