Rabadon FirstVHDL
Rabadon FirstVHDL
Choose VHDL as the language to code VHDL in EDA playground and also you can run different codes
such as python. EDA playground lets you run a hardware design circuit codes such as VHDL in an easy
way compare when running it to ISE application.
4. Resources:
Computer System with internet access
5. Procedure:
1. Search the website www.edaplayground.com as seen in Fig.1.
2. You need to log in using google or facebook account first as seen in Figure 5.2.
Figure 5.2. Signed-in Account
3. Click your chosen account either through Google or Facebook like in Fig.3.
4. You can see an empty work space in Fig. 5.4. From the left part is the word “testbench” and
on the right part is the word “design”. You can also see the Languages and Libraries located at
the leftmost part of the window. Select VHDL as your Testbench + Design.
Figure 5.4 Testbench and Design
5. Write “SampleCode1” in Fig. 5.5 where you can see “Add a title to help you find your
playground”.
Same as the top entity name on the left side of the test bench window is the same name you
wrote on the title, if you remember I write the name “SampleCode1”.
6. Click private (only you can view) beside the title text box as shows in Fig. 5.6.
Figure 5.6. Selected Private Only
7. Hit save but a prompt message will appear stating that you need to choose simulators. Fig.
5.7 is the selected tools and simulators which is Aldec Riviera Pro 2017.02. Under the Tools &
Simulators beside the testbench window choose “Aldec Riviera Pro 2017.02”.
8. Check the Open EPWave like in Fig. 5.8 after Run Options. Hit the save button again below
the testbench and design window to check errors.
Figure 5.8 Open EPWave
Check the Open EPWave after run. Hit the save button again below the testbench and design
window to check errors.
9. Once SampleCode1 was saved, you can see the “library ieee; and use
ieee.std_logic_1164.all;” will appeared in the testbench and design area. Copy and paste the
given code below on the testbench area.
-- Testbench for OR gate
library IEEE;
use IEEE.std_logic_1164.all;
entity testbench is
-- empty
end testbench;
architecture tb of testbench is
-- DUT component
component or_gate is
port(
a: in std_logic;
b: in std_logic;
q: out std_logic);
end component;
begin
-- Connect DUT
DUT: or_gate port map(a_in, b_in, q_out);
process
begin
a_in <= '0';
b_in <= '0';
wait for 1 ns;
assert(q_out='0') report "Fail 0/0" severity error;
-- Clear inputs
a_in <= '0';
b_in <= '0';
11. Copy and paste the following code to design area on the right side of the testbench area:
-- Simple OR gate design
library IEEE;
use IEEE.std_logic_1164.all;
entity or_gate is
port(
a: in std_logic;
b: in std_logic;
q: out std_logic);
end or_gate;
12. Now inside the testbench part you can see the word component as seen in Fig. 5.11.
14. You can now see the EPwave which mean EDA Playground waveform in Fig. 5.13.
15. You can choose radix to change either hex or binary numbers for the variable value in Fig.
5.14.
Figure 5.14 Radix Value
Once you change the radix to binary you can see the values
16. You can also change the zoom view in Fig. 5.16.
Figure 5.16 Zoom View
17. Move left or right the vertical yellow line to different location in Fig.5.17.
X means no value was given from the testbench but of course since this is an OR gate logic
once there is a high value it is always equivalent to 1 in Fig.5.18.
Figure 5.18 Yellow Line 2
entity SampleCode1 is
-- empty
end SampleCode1;
-- DUT component
component nor_gate is
port(
a: in std_logic;
b: in std_logic;
q: out std_logic);
end component;
begin
-- Connect DUT
DUT: nor_gate port map(a_in, b_in, q_out);
process
begin
a_in <= '0';
b_in <= '0';
wait for 1 ns;
assert(q_out='0') report "Fail 0/0" severity error;
-- Clear inputs
a_in <= '0';
b_in <= '0';
entity nor_gate is
port(
a: in std_logic;
b: in std_logic;
q: out std_logic);
end nor_gate;