minigecko,
The code I posted for generating a clock signal is only usable in testbenches, this means it will not synthesize.
Also the entity of a testbench is allways empty.
You should see a testbench as a simulation of the real world, the environment of your FPGA or PLD. That is why it has no ports, where would it interface to?
In a testbench you write 'software' you describe how input ports of your design will behave. That is why in a testbench you can write things like wait for 10 ns, inside a real FPGA or PLD how would the FPGA now when the 10 ns are passed?
A real FPGA nows this only because there is a new rising (or falling) edge on a real clock signal of 50MHz (period 20 ns).
so a testbench should look like this.
lets assume you design is the entity design
It has a clock input and one other input and one output.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity design_tb
-- empty
end design_tb
arhitecture behavior of design_tb is
component design
port (
clk : in std_logic;
input : in std_logic;
output : out std_logic
)
signal clk : std_logic;
signal input : std_logic;
signal output : std_logic;
--component instantiation
-- this is where you map the internally generated signals
-- in your testbench to the ports of your design
i_design : design
port map(
clk => clk,
input => input,
output => output
);
-- now here are the generated inputs for your design
-- a 50 MHz clock (period is 20 ns)
procClock : process
begin
clk <= '0';
loop
wait for 10 ns;
Clk <= not Clk;
wait for 10 ns;
end loop;
end process procClock;
-- process that describes how input will behave in time
-- because a testbench will never be synthesized you can
-- easily tell the simulator to wait for xxx ns or yyy us
procGenInput : process
begin
input <= '0';
wait for 200 ns;
input <= '1';
wait for 20 ns;
input <= '0';
wait for 150 ns;
input <= '1';
wait for 40 ns;
input <= '0';
wait;
end process procGenInput;
end behavior;
So basically a testbench is allways an empty entity and in the architecture you generate the inputs for the design you want to test and map these genrated signals to the ports of your design.
I hope this is clear for you?
If not let me know I'll try to explain it some more.
Just for info?
How are you learning VHDL?
From a book? In a course?
For information I am not familiar with simili, I use modelsim to simulate my designs. I do have expierence with Quartus, but mostly for synthesis.
Regards
jeandelfrigo