The following resources come from the 2009/10 BEng in Digital Systems and Computer Engineering (course number 2ELE0065) from the University of Hertfordshire. All the mini projects are designed as level two modules of the undergraduate programmes.
The objectives of this module are to demonstrate, within an embedded development environment:
• Processor – to – processor communication • Multiple processors to perform one computation task using parallel processing
This project requires the establishment of a communication protocol between two 68000-based microcomputer systems. Using ‘C’, students will write software to control all aspects of complex data transfer system, demonstrating knowledge of handshaking, transmission protocols, transmission overhead, bandwidth, memory addressing. Students will then demonstrate and analyse parallel processing of a mathematical problem using two processors. This project requires two students working as a team.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
2ELE0065
Mini Project ROM-Based Sine Wave Generator
Introductory Lecture
BSc Hon. Multimedia Technology. Mini Projects.
Author: University of HertfordshireDate created:Date revised: 2009
AbstractThe following resources come from the 2009/10 BEng in Digital Systems and Computer Engineering (course number 2ELE0065) from the University of Hertfordshire. All the mini projects are designed as level two modules of the undergraduate programmes.
The objectives of this module are to demonstrate, within an embedded development environment:
• Processor – to – processor communication• Multiple processors to perform one computation task using parallel processing
This project requires the establishment of a communication protocol between two 68000-based microcomputer systems. Using ‘C’, students will write software to control all aspects of complex data transfer system, demonstrating knowledge of handshaking, transmission protocols, transmission overhead, bandwidth, memory addressing. Students will then demonstrate and analyse parallel processing of a mathematical problem using two processors. This project requires two students working as a team.
Contents– Outline– Sequential Logic– D Flip-Flop– D Flip-FLOP with Asynchronous RESET– D Flip-FLOP with Synchronous RESET– 2-bit Counter with Asynchronous RESET– Memories– Array Types– Array type conversion– Conversion Summary– Resizing– Modelling memories – RAM– Modelling memories – ROM– VHDL Test Benches– WAIT Statement– Assertion Statement– A Test Bench Template– A Test Bench Example– Credits
In addition to the resources found below there are supporting documents which should be used in combination with this resource. Please see:
Mini Projects - Introductory presentation.
Mini Projects - E-Log.
Mini Projects - Staff & Student Guide.
Mini Projects - Standard Grading Criteria.
Mini Projects - Reflection.
You will also need the ‘Mini Project- ROM-Based Sine Wave Generator’ text document.
2ELE0065 Outline
Sequential design using VHDL
o Flip Flops
o Counters
o Memories
RAMs
ROMs
2ELE0065 Sequential Logic
Digital electronics is classified into:o Combinatorial logic
o Sequential logic
Combinatorial logic: output is a function of, and only of, the present input
Sequential logic : output depends not only on the present input but also on the history of the input
o It has storage (memory)
Combinatoriallogic Memory
element
Inputs
outputs
2ELE0065 Sequential Logic
Two types of Sequential circuits:
o Synchronous sequential circuits
o Asynchronous sequential circuits
Synchronous: logic responds to changes of input signals according to the state of a clock signal
Asynchronous: logic responds to the external system almost instantly
2ELE0065 D Flip-FLOP
D Q
D Flip-Flop
CLK
Timing diagram
CLK D Q (t+1)
0 - Q (t)
1 0 0
1 1 1
Truth table
t0 t1 t2 t3
CLK
D
Q
Time
2ELE0065 D Flip-FLOP
D Q
D Flip-Flop
CLK
entity DFF isport( D: in std_logic;
CLK: in std_logic;Q: out std_logic );
end DFF;----------------------------------------------architecture DFF_arch of DFF isbegin
process (CLK) begin
-- clock rising edge
if (CLK='1' and CLK'event) then Q <= D;end if;
end process;
end DFF_arch;
Detecting Rising Clock Edge:
(CLK='1' and CLK'event) or rising_edge(CLK)
Detecting Falling Clock Edge?
2ELE0065 D Flip-FLOP with Asynchronous RESET
Timing diagram t0 t1 t2 t3
CLK
D
QTime
ARESET
D Q
D Flip-Flop
CLK
ARESET
2ELE0065 D Flip-FLOP with Asynchronous RESET
D Q
D Flip-Flop
CLK
ARESET
entity DFF isport( D: in std_logic;
CLK: in std_logic;ARESET in std_logic;Q: out std_logic );
end DFF;----------------------------------------------architecture DFF_arch of DFF isbegin
process (CLK, ARESET) begin
if (ARESET =’1’) then Q <= '0';elsif (CLK='1' and CLK'event) then Q <= D;end if;
end process;
end DFF_arch;
2ELE0065 D Flip-FLOP with Synchronous RESET
Timing diagram
D Q
D Flip-Flop
CLK
SRESET
Exercise 1 entity DFF isport( D, CLK, SRESET: in std_logic;
--statement 3A <= resize (B, 8); -- or A <= B(7 downto 0)
--statement 4C <= resize (D, 8);
--statement 5C <= D(10 downto 3);
Statement 1
Statement 2
Statements 3 and 4
Statement 5
2ELE0065 Modelling memories - RAM
entity RAM_ENT is
port( CLK: in std_logic; EN: in std_logic; -- Enable RE: in std_logic; -- Read Enable WE: in std_logic; -- Write Enable RD_Addr: in std_logic_vector(8 downto 0); -- Read Address WR_Addr: in std_logic_vector(8 downto 0); -- Write Address WR_Data: in std_logic_vector(7 downto 0); -- Data input of RAM RD_Data: out std_logic_vector(7 downto 0) -- Data output of RAM);end RAM_ENT;
2ELE0065 Modelling memories - RAM
architecture RAM_ARCH of RAM_ENT is
type ram_type is array (0 to 511) of std_logic_vector(7 downto 0);
signal ram: ram_type;
begin -- Read process process(CLK, RE) begin if (CLK'event and CLK='1') then if EN='1' then if RE='1' then RD_Data <= ram(to_integer(unsigned(RD_Addr))); else RD_Data <= (others => 'Z'); end if; end if; end if; end process;
-- Write process process(CLK, WE) begin if (CLK'event and CLK='1') then if EN='1' then if WE='1' then ram(to_integer(unsigned(WR_Addr))) <= WR_Data; end if; end if; end if; end process;
end RAM_ARCH;
2ELE0065 Modelling memories - ROM
entity ROM_ent is port ( CLK : in std_logic; CE : in std_logic; RE : in std_logic; ADDR : in std_logic_vector (2 downto 0); DATA : out std_logic_vector (3 downto 0) );end ROM_ent;
2ELE0065 Modelling memories - ROM
architecture ROM_arch of ROM_ent is
type ROM is array (0 to 7) of std_logic_vector (3 downto 0);
process(CLK, RE, CE) begin if( CLK'event and CLK = '1' ) then if CE = '1' then if( RE = '1' ) then
DATA <= Content(to_integer(unsigned (ADDR)));
else DATA <= "ZZZZZZZZ"; end if; end if; end if; end process;
end ROM_arch;
2ELE0065
Wait statement
After Statement
Assertion statement
Writing a VHDL test bench
o Test Bench template
o Example
VHDL Test BenchesVHDL Test Benches
2ELE0065 WAIT Statement
The wait statement explicitly specifies the conditions under which a process may resume execution after being suspended
wait for time expression;
wait on signal;
wait until <condition>;
2ELE0065 WAIT Statement
1. Causes suspension of the process for a period of time given by the evaluation of time expression
2. Causes a process to suspend execution until an events occurs on one or more signals in a group of signals
3. The third form can specify a <condition> that evaluates to a Boolean value, TRUE or FALSE
1- wait for time expression;
wait for 10 ns;
2- wait on signal;
wait on clk, reset;
3- wait until <condition>;
wait until A>B;
2ELE0065 WAIT Statement - Example
A process that generates a clock with a 10 ns period
-- Clock generation process
Clock_gen: process
beginCLK <= '0';wait for 5 ns;CLK <= '1';wait for 5 ns;
end process clock_gen;
2ELE0065 Creating Signal Waveforms Using After Clause
It is possible to assign multiple values to a signal, each with a different delay value
Example
Must appear in increasing order
RESET <= ’1’, ’0’ after 10ns, ’1’ after 15ns,’0’ after 60ns;
2ELE0065 Assertion Statement
A statement that checks that a specified condition is true and reports an error if it is not
assert condition
report string
severity severity_level;
Must evaluate to a Boolean value (true or false)If false, it is said that an assertion violation occurred
A message to be reported when assertion violation occurred
Predefined severity names are: NOTE: used to pass information messages from simulatorWARNING: used in unusual situation in which the simulation can be continuedERROR: used when assertion violation makes continuation of the simulation not feasibleFAILURE: used when the assertion violation is a fatal error and the simulation must be stopped
2ELE0065 Assertion Statement
Example
assert not (S=’1’ and R=’1’)
report ”Both values of signals S and R are equal to 1”
severity error;
When the values of the signals S and R are equal to ’1’, the message is displayed and the simulation is stopped because the severity is set to error
2ELE0065 VHDL Test Bench
A test bench is a specification in VHDL that plays the role of a complete simulation environment for the analysed Design
o Analysed design: Unit Under Test (UUT)
A test bench contains:
o The UUT
o Stimuli for the simulation
2ELE0065 VHDL Test Bench
The UUT is instantiated as a component of the test bench
The architecture of the test bench specifies stimuli for the UUT’s ports
testbench
TesterUnit Under
Test(UUT)
2ELE0065 A Test Bench Template
testbenchUnit Under
Test(UUT)
Tester
entity model_name isport (input_signals: in type; output_signals: out type);end model_name;
architecture model_arch of model_name is
[Declarations]
begin
architecture body
end model_arch;
entity test_bench_name is --the entity interface is emptyend test_bench_name;
architecture test_bench_arch of test_bench_name is
-- Component declaration for the UUT
component model_name isport (input_signals: in type; output_signals: out type);end component;
--Declare all signals used to connect tester and model
signal internal_signals : type := initialisation;
begin
-- Instantiate the UUT
uut: model_name port map ( port => signal1, … );
-- Place stimulus here
end test_bench_arch;
2ELE0065 A Test Bench Example
Truth table
entity DFF isport( CLK: in std_logic;
D: in std_logic;Q: out std_logic;RESET: in std_logic );
end DFF;----------------------------------------------architecture DFF_arch of DFF isbegin
process (CLK, RESET) begin
-- Sequential statements -- to implement the D Filp-Flop
end process;
end DFF_arch;
VHDL code to describe the D FF
2ELE0065 A Test Bench Example
VHDL test bench to simulate the D FF
2ELE0065 A Test Bench Example
2ELE0065 A Test Bench Example
FALSE
2ELE0065 A Test Bench Exercise
entity JKFF isport( CLK, J, K, RESET: in std_logic;
Q: out std_logic );end JKFF;
architecture JKFF_arch of JKFF isbegin process (CLK, RESET) begin
-- Sequential statements -- to implement the JK FF
end process;
end JKFF_arch;
Write the process part of the test bench that generates the following inputs:
2ELE0065 Solution
2ELE0065
This resource was created by the University of Hertfordshire and released as an open educational resource through the Open Engineering Resources project of the HE Academy Engineering Subject Centre. The Open Engineering Resources project was funded by HEFCE and part of the JISC/HE Academy UKOER programme.
Where screenshots are taken from Altium Designer 6, and appear courtesy of Premier EDA Solutions Ltd.
This work is licensed under a Creative Commons Attribution 2.0 License.
The name of the University of Hertfordshire, UH and the UH logo are the name and registered marks of the University of Hertfordshire. To the fullest extent permitted by law the University of Hertfordshire reserves all its rights in its name and marks which may not be used except with its written permission.
The JISC logo is licensed under the terms of the Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England & Wales Licence. All reproductions must comply with the terms of that licence.
The HEA logo is owned by the Higher Education Academy Limited may be freely distributed and copied for educational purposes only, provided that appropriate acknowledgement is given to the Higher Education Academy as the copyright holder and original publisher.