| eqbit function Truth Table | eqbit C++ function |
x y e | eq 0 0 0 | 0 0 0 1 | 1 0 1 0 | 0 0 1 1 | 0 1 0 0 | 0 1 0 1 | 0 1 1 0 | 0 1 1 1 | 1 |
void eqbit( int x, int y, int e, int &eq)
{ eq = (x && y && e) || (!x && !y && e); } |
| eq4 function to determine if four bits are equal | Test function |
| void eq4(int a[4], int b[4], int &equal)
{ int s[4]; s[0] = 1;
|
#include <iostream.h>
void main(void)
eq4( m, n, equal);
|
| -- File eqbit.vhd
-- ENTITY - The interface part of design ENTITY eqbit IS PORT (x, y, e : IN BIT; eq : OUT BIT); END eqbit; -- ARCHITECTURE - The implementation part of the design
|
| -- File eq4.vhd
-- eq4 uses the eqbit component ENTITY eq4 IS PORT (a3, a2, a1, a0 : IN BIT; b3, b2, b1, b0 : IN BIT; equal : OUT BIT); END eq4; ARCHITECTURE structural OF eq4 IS
SIGNAL s0, s1, s2, s3 : BIT; BEGIN
|


the
total delay through the longest series of devices. However, due to the
technology used, a Field Programmable Gate Array that uses a lookup table
to implement a combinational device, the delay times are not easily determined,
usually requiring analysis by computer. In the simulation of eq4
device, instead of the expected 30 ns. total delay from when the
inputs change to when the output responds, the delay is 11.5 ns., much
better than expected. The simulation shows the change in the darkened area
where all inputs are 0 and output equal is 1, then when input a0
changes to 1 output equal, at the end of four eqbit devices,
requires 11.5 ns. to change.
One final point, while the text indicates that propagation delays can be specified in VHLD, the MAX+plus II package will not honor delays since it is simulating a known device with known propagation delay characteristics, one of the two Field Programmable Gate Arrays that will be used in later laboratories. The FPGA used by default has a minimum propagation delay of 7.5 ns.






xi yi | Encoded Result | 0 0 | a = b 0 1 | a < b 1 0 | a > b 1 1 | Don't CareUsing the encoding yields a truth table below. An example of its interpretation is for input 0100, the xiyi inputs of 00 indicate that the lower bits were all equal, the ab inputs of 01 indicate that a < b, given that lower bits were equal. An example would be where a = 011111 and b = 111111.
The Karnaugh map simplification for the bit comparator yields the outputs of xi+1 = ab'+axi+b'xi and yi+1 = a'b+a'yi+byi.
abxiyi | xi+1 yi+1 Meaning __________|_________________ 0000 | 0 0 a=b 0001 | 0 1 a<b 0010 | 1 0 a>b 0011 | don't care 0100 | 0 1 a<b 0101 | 0 1 a<b 0110 | 0 1 a<b 0111 | don't care 1000 | 1 0 a>b 1001 | 1 0 a>b 1010 | 1 0 a>b 1011 | don't care 1100 | 0 0 a=b 1101 | 0 1 a<b 1110 | 1 0 a>b 1111 | don't care |
|
ENTITY bitcomp IS
PORT( a, b, xi, yi : IN BIT;
xi1, yi1 : OUT BIT);
END bitcomp;
Four bit comparator
The design uses four bit comparators with the lower order bit comparator
feeding results into the next higher order bit comparator as in the following
diagram:
The four bit comparator design is quite similar to the eq4, a VHDL ENTITY could be:
ENTITY comp4 IS
PORT( a3, a2, a1, a0, b3, b2, b1, b0 : IN BIT;
x, y : OUT BIT);
END comp4;
EQUIPMENT
MAX+plus IIASSIGNMENT