first commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
## Default .gitignore for VHDPlus Projects
|
||||
|
||||
## Ignore generated vhdl files, files generated by compiling with quartus
|
||||
Generated/
|
||||
incremental_db/
|
||||
output_files/
|
||||
db/
|
||||
|
||||
## MacOS
|
||||
.DS_Store
|
||||
|
||||
## ModelSim
|
||||
Modelsim/
|
||||
|
||||
## Quartus specific.
|
||||
## *.qsf
|
||||
## *.qpf
|
||||
|
||||
## ISSP
|
||||
Libraries/.qsys_edit
|
||||
|
||||
## NIOS
|
||||
*.map
|
||||
*.objdump
|
||||
*.elf
|
||||
*.flash
|
||||
*.sopcinfo
|
||||
|
||||
## Clangd
|
||||
.clangd/
|
||||
.cache/
|
||||
obj/
|
||||
mem_init/
|
||||
|
||||
## BSP Libraries
|
||||
**/Software/**/generated_bsp/
|
||||
**/Software/**/compile_commands.json
|
||||
|
||||
## Python
|
||||
*__pycache__*
|
||||
@@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<File Include="clkgen.vhd" />
|
||||
<File Include="design.vhd" />
|
||||
<File Include="testbench.vhd" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1,24 @@
|
||||
-- Clock Generator
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
|
||||
entity clkGen is
|
||||
port (clk : out std_logic);
|
||||
end clkGen;
|
||||
|
||||
architecture behavior of clkGen is
|
||||
|
||||
constant clk_period : time := 10 ns;
|
||||
|
||||
begin
|
||||
clkgen : process
|
||||
|
||||
begin
|
||||
|
||||
clk <= '0';
|
||||
wait for clk_period/2;
|
||||
clk <= '1';
|
||||
wait for clk_period/2;
|
||||
end process clkgen;
|
||||
end behavior;
|
||||
@@ -0,0 +1,24 @@
|
||||
-- Code your design here
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
entity myDFF is
|
||||
port ( clk:in std_logic;
|
||||
D:in std_logic;
|
||||
reset:in std_logic;
|
||||
Q:out std_logic);
|
||||
end myDFF;
|
||||
|
||||
architecture beh of myDFF is
|
||||
begin
|
||||
|
||||
DFF: process ( Clk, reset )
|
||||
begin
|
||||
If reset ='1' then
|
||||
Q <='0';
|
||||
Elsif (Clk'event and Clk ='1') then
|
||||
Q <= D ;
|
||||
end if ;
|
||||
end process DFF;
|
||||
|
||||
end beh;
|
||||
@@ -0,0 +1,60 @@
|
||||
-- Code your testbench here
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
|
||||
|
||||
entity testbench is
|
||||
end testbench;
|
||||
|
||||
architecture tb of testbench is
|
||||
|
||||
component myDFF is
|
||||
port ( clk:in std_logic;
|
||||
D:in std_logic;
|
||||
reset:in std_logic;
|
||||
Q:out std_logic);
|
||||
end component;
|
||||
|
||||
component clkGen is
|
||||
port (clk : out std_logic);
|
||||
end component;
|
||||
|
||||
signal sig_D, sig_clk, sig_Q, sig_reset : std_logic;
|
||||
|
||||
begin
|
||||
DUT: myDFF port map(
|
||||
clk => sig_clk,
|
||||
D => sig_D,
|
||||
reset => sig_reset,
|
||||
Q => sig_Q
|
||||
);
|
||||
|
||||
mClkGen : clkGen port map(
|
||||
clk => sig_clk
|
||||
);
|
||||
|
||||
res_stim : process
|
||||
begin
|
||||
sig_reset <= '0';
|
||||
wait for 2 ns;
|
||||
sig_reset <= '1';
|
||||
wait for 10 ns;
|
||||
sig_reset <= '0';
|
||||
wait for 20 ns;
|
||||
sig_reset <= '1';
|
||||
wait for 1 ns;
|
||||
sig_reset <= '0';
|
||||
wait;
|
||||
end process res_stim;
|
||||
|
||||
d_stim : process
|
||||
begin
|
||||
sig_D <= '0';
|
||||
wait for 17 ns;
|
||||
sig_D <= '1';
|
||||
wait for 30 ns;
|
||||
sig_D <= '0';
|
||||
wait;
|
||||
end process d_stim;
|
||||
|
||||
end tb;
|
||||
@@ -0,0 +1,8 @@
|
||||
# auto-generated
|
||||
[Libraries]
|
||||
work.files = [
|
||||
]
|
||||
[libraries.work]
|
||||
files = [
|
||||
]
|
||||
# auto-generated-end
|
||||
Reference in New Issue
Block a user