Friday, September 10, 2010

Experiment 4 – Sequential Code

I. ABSTRACT


This experiment deals with writing a sequential code for an up counter with the required parameters.

II. OBJECTIVES

1. To be able to create a sequential code using VHDL.

1.1. Create an up-counter with an input and reset.

1.2. Create a 2-digit count up counter using count up counter using down module in 1.1 and a BCD decoder.

III. THEORETICAL FRAMEWORK


In digital logic and computing, a counter is

a device which stores (and sometimes displays) the number of times a particular event orprocess has occurred, often in relationship to a

clock signal. In practice, there are two types of counters: Up counters, which increase (increment) in value and Down counters, which decrease (decrement) in value.

In electronics, counters can be implemented quite easily using register-type circuits such as the flip-flop, and a wide variety of designs exist, e.g.:

Asynchronous (ripple) counter – changing state bits are used as clocks to subsequent state flip-flops

Synchronous counter – all state bits change under control of a single clock

Decade counter – counts through ten states per stage

Up–down counter – counts both up and down, under command of a control input

Ring counter – formed by a shift register with

feedback connection in a ring

Johnson counter – a twisted ring counter

Cascaded counter

Each is useful for different applications. Usually, counter circuits are digital in nature, and count in natural binary. Many types of counter circuit are available as digital building blocks, for example a number of chips in the 4000 series implement different counters.

Occasionally there are advantages to using a counting sequence other than the natural binary sequence—such as the binary coded decimalcounter, a linear feedback shift register counter, or a Gray-code counter. Counters are useful for digital clocks and timers, and in oven timers, VCR clocks, etc.

IV. CONCEPTUAL FRAMEWORK

Counter






Counter Vector Waveform





Decoder








Circuit Diagram







V. DATA AND RESULTS


1.1

LIBRARY ieee;

USE ieee.std_logic_1164.all;

ENTITY etonatalaga IS

PORT (I : IN BIT_VECTOR(3 DOWNTO 0);

O : OUT BIT_VECTOR(6 DOWNTO 0));

END etonatalaga;

ARCHITECTURE cutee OF etonatalaga IS

BEGIN

WITH I SELECT

O <="0000001" WHEN "0000",

"1001111"WHEN"0001",

"0010010"WHEN"0010",

"0000110"WHEN"0011",

"1001100"WHEN"0100",

"0100100"WHEN"0101",

"0100000"WHEN"0110",

"0001111"WHEN"0111",

"0000000"WHEN"1000",

"0000100"WHEN"1001",

"0000010"WHEN"1010",

"1100000"WHEN"1011",

"0110001"WHEN"1100",

"1000010"WHEN"1101",

"0010000"WHEN"1110",

"0111000"WHEN"1111";

END cutee;


1.2

Library ieee;

Use ieee.std_logic_1164.all;


Entity pierrecardin is

Port (x, y :in std_logic;

a: out std_logic_vector(0 to 3):="0000";

b: out std_logic);

End pierrecardin;


Architecture counter of pierrecardin is

begin

Process

Variable timer: integer range 0 to 10 :=0;

begin

wait until (x'EVENT AND x = '1');

timer := timer + 1;

If (timer = 10) Then

b <= '1';

timer := 0; else b<='0';

End If;

If (y = '0') then timer:=0;

End If;


case timer is

when 0 => a <= "0000";

when 1 => a <= "0001";

when 2 => a <= "0010";

when 3 => a <= "0011";

when 4 => a <= "0100";

when 5 => a <= "0101";

when 6 => a <= "0110";

when 7 => a <= "0111";

when 8 => a <= "1000";

when 9 => a <= "1001";

when 10 => a <= "0000";

end case;

end process;

end counter;




VI. ANALYSIS


The experiment requires us to make an up-counter with an input and reset. We have successfully created a 2-digit up counter which counts up to 99 before reseting. At any given time, we may also reset the counter back to zero. This particular sequential code works by pushing the assigned button in the DE board for it to count up or reset.


VII. CONCLUSION


We have concluded that in learning to implement sequential data in VHDL, we would be able to easily apply this in a number of hardware devices such as a digital score board or anything that requires counting digitally.

Sunday, August 22, 2010

Experiment 3 - Combinational Logic Circuit of a Multiplexer and a Comparator

I. ABSTRACT

We will be implementing in this experiment, using combinational logic circuits, a comparator and multiplexer. Outputs can only be determined by their current input state.


II. OBJECTIVE

To be able to implement in VHDL the combinational logic circuits of a multiplexer and a comparator.

III. THEORETICAL FRAMEWORK
The outputs of Combinational Logic circuits are only determined by their current input state as they have no feedback, and any changes to the signals being applied to their inputs will immediately have an effect at the output. In other words, in a Combination Logic circuit, if the input condition changes state so too does the output as combinational circuits have No Memory.

They are made up from basic logic AND, OR or NOT gates that are "combined" or connected together to produce more complicated switching circuits. As combination logic circuits are made up from individual logic gates they can also be considered as "decision making circuits" and combinational logic is about combining logic gates together to process two or more signals in order to produce at least one output signal according to the logical function of each logic gate. Common combinational circuits made up from individual logic gates include Multiplexers,Decoders and De-multiplexers, Full and Half Adders etc.

A multiplexer, abbreviated mux, is a device that has multiple inputs and one output.

Digital or Binary Comparators are made up from standard AND, NOR and NOT gates that compare the digital signals at their input terminals and produces an output depending upon the condition of the inputs. For example, whether input A is greater than, smaller than or equal to input B etc. Digital Comparators can compare a variable or unknown number for example A (A1, A2, A3, .... An, etc) against that of a constant or known value such as B (B1, B2, B3, .... Bn, etc) and produce an output depending upon the result.

IV. CONCEPTUAL FRAMEWORK

The schematic symbol for multiplexers is

The truth table for a 2-to-1 multiplexer is


V. DATA AND RESULTS

1) 2-1 muiltiplexer

LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY yayi IS
PORT (a,b : IN BIT_VECTOR(3 DOWNTO 0);
x:in bit;
z : OUT BIT_Vector(3 DOWNTO 0));
END yayi;
ARCHITECTURE exx OF yayi IS
BEGIN
z <= a when x ='0' else b;
end exx;

2) comparator

LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY maxx IS
PORT (a,b : IN BIT_VECTOR(3 DOWNTO 0);
x : OUT BIT );
END maxx;
ARCHITECTURE yahu OF maxx IS
BEGIN
x <='1' when b > a else '0';
end yahu;

3) 7segment using common anode

LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY etonatalaga IS
PORT (I : IN BIT_VECTOR(3 DOWNTO 0);
O : OUT BIT_VECTOR(6 DOWNTO 0));
END etonatalaga;
ARCHITECTURE cutee OF etonatalaga IS
BEGIN
WITH I SELECT
O <="0000001" WHEN "0000",
"1001111"WHEN"0001",
"0010010"WHEN"0010",
"0000110"WHEN"0011",
"1001100"WHEN"0100",
"0100100"WHEN"0101",
"0100000"WHEN"0110",
"0001111"WHEN"0111",
"0000000"WHEN"1000",
"0000100"WHEN"1001",
"0000010"WHEN"1010",
"1100000"WHEN"1011",
"0110001"WHEN"1100",
"1000010"WHEN"1101",
"0010000"WHEN"1110",
"0111000"WHEN"1111";
END cutee;





VI. ANALYSIS

The exercise is composed of 3 different circuit on which has 3 different functions. The first one is the multiplexer where its function has 2 inputs it maybe 0 or 1 that has only one output. The second circuit is the comparator where its function is mainly to compare the inputs bits. In the circuit it chooses the higher bits of the inputs and the last part circuit would be the 7 segment decoder. These where combined to form one new circuit, it’s function is to have a 7 segment decoder that has the ability to compare its input bits. The higher input would be chosen and will not change its value.

VII. CONCLUSION

The circuit done was somewhat exciting and challenging in our part students. Here we have made 3 different circuit and cascaded it into one that may have new function and features. In this type of experiment we learned and proved its application (The VHDL), that project circuit may be design, verified and simulate before applying it into real hardware. Less time and effort may be it advantages and may be effective.

Friday, July 23, 2010

Experiment 2 – Concurrent Code

I. ABSTRACT


This experiment deals with writing concurrent codes for a 4-bit BCD 7-segment and for an 8-bit multiplexer.

II. OBJECTIVES

1. To be able to implement concurrent data to VHDL.

1.1. VHDL code for 4-bit BCD 7-segment

1.2. VHDL for 8-bit multiplexer

III. THEORETICAL FRAMEWORK

A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the Arabic numerals. Often the seven segments are arranged in an oblique (slanted) arrangement, which aids readability. In most applications, the seven segments are of nearly uniform shape and size (usually elongated hexagons, though trapezoids and rectangles can also be used), though in the case of adding machines, the vertical segments are longer and more oddly shaped at the ends in an effort to further enhance readability.


A multiplexer or mux (occasionally the terms muldex or muldem are also found for a combination multiplexer-demultiplexer) is a device that performs multiplexing; it selects one of many analog or digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the output.


Concurrent computing is a form of computing in which programs are designed as collections of interacting computational processes that may be executed in parallel. Concurrent programs can be executed sequentially on a single processor by interleaving the execution steps of each computational process, or executed in parallel by assigning each computational process to one of a set of processors that may be close or distributed across a network. The main challenges in designing concurrent programs are ensuring the correct sequencing of the interactions or communications between different computational processes, and coordinating access to resources that are shared among processes. A number of different methods can be used to implement concurrent programs, such as implementing each computational process as an operating system process, or implementing the computational processes as a set of threads within a single operating system process.


IV. CONCEPTUAL FRAMEWORK


Multiplexer Flowchart

























V. DATA AND RESULTS


VHDL code for 4-bit BCD 7-segment


LIBRARY ieee;

USE ieee.std_logic_1164.all;

ENTITY etonatalaga IS

PORT (I : IN BIT_VECTOR(3 DOWNTO 0);

O : OUT BIT_VECTOR(6 DOWNTO 0));

END etonatalaga;

ARCHITECTURE cutee OF etonatalaga IS

BEGIN

WITH I SELECT

O <="0000001" WHEN "0000",

"1001111"WHEN"0001",

"0010010"WHEN"0010",

"0000110"WHEN"0011",

"1001100"WHEN"0100",

"0100100"WHEN"0101",

"0100000"WHEN"0110",

"0001111"WHEN"0111",

"0000000"WHEN"1000",

"0000100"WHEN"1001",

"0000010"WHEN"1010",

"1100000"WHEN"1011",

"0110001"WHEN"1100",

"1000010"WHEN"1101",

"0010000"WHEN"1110",

"0111000"WHEN"1111";

END cutee;


VHDL for 8-bit multiplexer


LIBRARY ieee;

USE ieee.std_logic_1164.all;


ENTITY wiwi IS

PORT (x, y, z, a, b, c, d, e, f, g, h : In bit;

q : OUT BIT);

END wiwi;


ARCHITECTURE lolipop OF wiwi IS

BEGIN

q <= (a AND not x AND not y AND not z) OR

(b AND not x AND not y AND z) OR

(c AND not x AND y AND not z) OR

(d AND not x AND y AND z) OR

(e AND x AND not y AND not z) OR

(f AND x And not y AND z) OR

(g AND x AND y AND not z) OR

(h AND z AND y AND z);

END lolipop;


Video of results


4-bit BCD 7-segment


8-bit multiplexer



VI. ANALYSIS


The first part of the experiment requires us to again simulate a 4-bit BCD 7-segment but this time using concurrent codes. This saved our group significant time and effort compared to the previous laboratory experiment. Once we figured out how to write the VHDL code, it is only a matter of compiling and simulating it on the DE2. The Second part deals with an 8-bit multiplexer. the goal is to incorporate the various inputs into one output which is done with OR and AND gates written in the VHDL code yeilding the desired result on the DE2.


VII. CONCLUSION


We have concluded that in learning to implement concurrent data in VHDL, we would be able to speed up the whole process of simulation be it a 4-bit BCD 7-segment or an 8-bit multiplexer.