Lab 2
Modeling of simple system
The purpose of this lab is to model quite simple system, which consists of some components. The behaviour of the system is the following. There are two bit sequences, which change their values only at the negative front of clock signal. There should be two counters, which summarize value of sequences at 2 previous clock cycles. System must consist of 3 parallel working components:
· Two similar modules, every count bits of its inputs and output number of bits at 2 previous clock cycles;
· adder, which outputs 1 if sum of bits number in sequences 1 and 2 equal to 3, otherwise outputs 0.
Example of realization:
Presented waveforms illustrate one possible realization, which consists of 4 parallel parts:
seq1 11011000010110101001 and seq2 - 00111011000010110101
The period of clock signal is 50 ns, the length of sequences is 20 bits, therefore for the simulation it is enough 1000 ns.
Requirements:
sgn<= value1 when condition else value2 when condition2 else valueN;
Hints:
·
To save
sequence data you can use the following VHDL code:
constant seq1_arr: bit_vector (0 to 19) :=
"11011000010110101001";
·
To wait the
rising edge of clock signal you can use the following VHDL code:
wait until clk'event and clk='1';
·
For loops
in VHDL:
for i in a_arr'range loop
end loop;