Skip to content

Commit 9b8642f

Browse files
committed
Build for arty demo
1 parent f6eb3ae commit 9b8642f

34 files changed

+9068
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FIG/digilent_arty/dut/vivado_project/
2+
*.bin
3+
*.bit
4+
*.edf

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "FIG/digilent_arty/dut/soft_riscv"]
2+
path = FIG/digilent_arty/dut/sw/soft_riscv
3+
url = https://github.com/AEW2015/soft_riscv.git
4+
[submodule "FIG/digilent_arty/dut/hdl/kronos"]
5+
path = FIG/digilent_arty/dut/kronos
6+
url = https://github.com/SonalPinto/kronos.git
7+
[submodule "FIG/digilent_arty/dut/hdl/picorv32"]
8+
path = FIG/digilent_arty/dut/picorv32
9+
url = https://github.com/YosysHQ/picorv32.git

FIG/digilent_arty/dut/build_dut.tcl

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#*****************************************************************************************
2+
# Vivado (TM) v2021.2.1 (64-bit)
3+
#
4+
# build_dut.tcl: Tcl script for re-creating project 'arty_kornos'
5+
#
6+
# Generated by Vivado on Tue Nov 01 11:12:33 -0600 2022
7+
# IP Build 3405791 on Sun Dec 19 15:54:35 MST 2021
8+
#
9+
# This file contains the Vivado Tcl commands for re-creating the project to the state*
10+
# when this script was generated. In order to re-create the project, please source this
11+
# file in the Vivado Tcl Shell.
12+
#
13+
# * Note that the runs in the created project will be configured the same way as the
14+
# original project, however they will not be launched automatically. To regenerate the
15+
# run results please launch the synthesis/implementation runs as needed.
16+
#
17+
#*****************************************************************************************
18+
19+
# Check file required for this script exists
20+
21+
# Set the reference directory for source file relative paths (by default the value is script directory path)
22+
set origin_dir "."
23+
24+
# Use origin directory path location variable, if specified in the tcl shell
25+
if { [info exists ::origin_dir_loc] } {
26+
set origin_dir $::origin_dir_loc
27+
}
28+
29+
# Set the project name
30+
set _xil_proj_name_ "vivado_project"
31+
32+
# Use project name variable, if specified in the tcl shell
33+
if { [info exists ::user_project_name] } {
34+
set _xil_proj_name_ $::user_project_name
35+
}
36+
37+
variable script_file
38+
set script_file "build_dut.tcl"
39+
40+
41+
42+
# Create project
43+
create_project ${_xil_proj_name_} ./${_xil_proj_name_} -part xc7a35ticsg324-1L
44+
45+
# Set the directory path for the new project
46+
set proj_dir [get_property directory [current_project]]
47+
48+
# Set project properties
49+
set obj [current_project]
50+
set_property -name "board_part" -value "digilentinc.com:arty-a7-35:part0:1.0" -objects $obj
51+
set_property -name "default_lib" -value "xil_defaultlib" -objects $obj
52+
set_property -name "enable_vhdl_2008" -value "1" -objects $obj
53+
set_property -name "ip_cache_permissions" -value "read write" -objects $obj
54+
set_property -name "ip_output_repo" -value "$proj_dir/${_xil_proj_name_}.cache/ip" -objects $obj
55+
set_property -name "mem.enable_memory_map_generation" -value "1" -objects $obj
56+
set_property -name "platform.board_id" -value "arty" -objects $obj
57+
set_property -name "revised_directory_structure" -value "1" -objects $obj
58+
set_property -name "sim.central_dir" -value "$proj_dir/${_xil_proj_name_}.ip_user_files" -objects $obj
59+
set_property -name "sim.ip.auto_export_scripts" -value "1" -objects $obj
60+
set_property -name "simulator_language" -value "Mixed" -objects $obj
61+
set_property -name "target_language" -value "VHDL" -objects $obj
62+
set_property -name "webtalk.activehdl_export_sim" -value "18" -objects $obj
63+
set_property -name "webtalk.ies_export_sim" -value "10" -objects $obj
64+
set_property -name "webtalk.modelsim_export_sim" -value "18" -objects $obj
65+
set_property -name "webtalk.questa_export_sim" -value "18" -objects $obj
66+
set_property -name "webtalk.riviera_export_sim" -value "18" -objects $obj
67+
set_property -name "webtalk.vcs_export_sim" -value "18" -objects $obj
68+
set_property -name "webtalk.xcelium_export_sim" -value "5" -objects $obj
69+
set_property -name "webtalk.xsim_export_sim" -value "18" -objects $obj
70+
set_property -name "webtalk.xsim_launch_sim" -value "20" -objects $obj
71+
set_property -name "xpm_libraries" -value "XPM_CDC XPM_FIFO XPM_MEMORY" -objects $obj
72+
73+
# Create 'sources_1' fileset (if not found)
74+
if {[string equal [get_filesets -quiet sources_1] ""]} {
75+
create_fileset -srcset sources_1
76+
}
77+
78+
79+
80+
# Add local files from the original project (-no_copy_sources specified)
81+
set files [list \
82+
[file normalize "${origin_dir}/hdl/kronos_v.vhd" ]\
83+
[file normalize "${origin_dir}/picorv32/picorv32.v" ]\
84+
85+
]
86+
set added_files [add_files -fileset sources_1 $files]
87+
88+
89+
# Set 'sources_1' fileset file properties for local files
90+
set file "hdl/kronos_v.vhd"
91+
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
92+
set_property -name "file_type" -value "VHDL" -objects $file_obj
93+
set_property -name "is_enabled" -value "1" -objects $file_obj
94+
set_property -name "is_global_include" -value "0" -objects $file_obj
95+
set_property -name "library" -value "xil_defaultlib" -objects $file_obj
96+
set_property -name "path_mode" -value "RelativeFirst" -objects $file_obj
97+
set_property -name "used_in" -value "synthesis simulation" -objects $file_obj
98+
set_property -name "used_in_simulation" -value "1" -objects $file_obj
99+
set_property -name "used_in_synthesis" -value "1" -objects $file_obj
100+
101+
set file "picorv32/picorv32.v"
102+
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
103+
set_property -name "file_type" -value "Verilog" -objects $file_obj
104+
set_property -name "is_enabled" -value "1" -objects $file_obj
105+
set_property -name "is_global_include" -value "0" -objects $file_obj
106+
set_property -name "library" -value "xil_defaultlib" -objects $file_obj
107+
set_property -name "path_mode" -value "RelativeFirst" -objects $file_obj
108+
set_property -name "used_in" -value "synthesis simulation" -objects $file_obj
109+
set_property -name "used_in_simulation" -value "1" -objects $file_obj
110+
set_property -name "used_in_synthesis" -value "1" -objects $file_obj
111+
112+
import_files -norecurse ${origin_dir}/ip/clk_wiz_0.xci
113+
set_property ip_repo_paths $origin_dir/ip/ip_repo [current_project]
114+
update_ip_catalog
115+
116+
source ./tcl/kron_bd.tcl
117+
update_compile_order -fileset sources_1
118+
119+
120+
121+
# Set 'sources_1' fileset properties
122+
set obj [get_filesets sources_1]
123+
set_property -name "design_mode" -value "RTL" -objects $obj
124+
set_property -name "edif_extra_search_paths" -value "" -objects $obj
125+
set_property -name "elab_link_dcps" -value "1" -objects $obj
126+
set_property -name "elab_load_timing_constraints" -value "1" -objects $obj
127+
set_property -name "generic" -value "" -objects $obj
128+
set_property -name "include_dirs" -value "" -objects $obj
129+
set_property -name "lib_map_file" -value "" -objects $obj
130+
set_property -name "loop_count" -value "1000" -objects $obj
131+
set_property -name "name" -value "sources_1" -objects $obj
132+
set_property -name "top" -value "tma_wrap" -objects $obj
133+
set_property -name "top_auto_set" -value "0" -objects $obj
134+
set_property -name "verilog_define" -value "" -objects $obj
135+
set_property -name "verilog_uppercase" -value "0" -objects $obj
136+
set_property -name "verilog_version" -value "verilog_2001" -objects $obj
137+
set_property -name "vhdl_version" -value "vhdl_2k" -objects $obj
138+
139+
# Create 'constrs_1' fileset (if not found)
140+
if {[string equal [get_filesets -quiet constrs_1] ""]} {
141+
create_fileset -constrset constrs_1
142+
}
143+
144+
add_files $origin_dir/kronos/rtl
145+
add_files $origin_dir/hdl
146+
add_files -fileset constrs_1 $origin_dir/xdc/arty_a7.xdc
147+
set_property top design_1_wrapper [current_fileset]
148+
149+
update_compile_order -fileset sources_1
150+
151+
update_compile_order -fileset sources_1
152+
153+
puts "INFO: Project created:${_xil_proj_name_}"
154+
155+
set_property generic "NUM_PROS=1 USE_BSCAN=false" [current_fileset]
156+
set_property strategy Flow_AlternateRoutability [get_runs synth_1]
157+
set_property STEPS.SYNTH_DESIGN.ARGS.FLATTEN_HIERARCHY rebuilt [get_runs synth_1]
158+
set_property STEPS.SYNTH_DESIGN.ARGS.RETIMING true [get_runs synth_1]
159+
160+
set_property STEPS.WRITE_BITSTREAM.ARGS.BIN_FILE true [get_runs impl_1]
161+
162+
launch_runs impl_1 -to_step write_bitstream -jobs 6
163+
wait_on_run impl_1
164+
open_run impl_1
165+
write_edif $origin_dir/outputs/kronos.edf
166+
write_bitstream -bin_file $origin_dir/outputs/kronos.bit
167+
168+
close_project

FIG/digilent_arty/dut/hdl/FIFO.vhd

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
----------------------------------------------------------------------------------
2+
-- Company:
3+
-- Engineer:
4+
--
5+
-- Create Date: 03/03/2017 11:08:09 AM
6+
-- Design Name:
7+
-- Module Name: FIFO - Behavioral
8+
-- Project Name:
9+
-- Target Devices:
10+
-- Tool Versions:
11+
-- Description:
12+
--
13+
-- Dependencies:
14+
--
15+
-- Revision:
16+
-- Revision 0.01 - File Created
17+
-- Additional Comments:
18+
--
19+
----------------------------------------------------------------------------------
20+
21+
22+
library IEEE;
23+
use IEEE.STD_LOGIC_1164.ALL;
24+
25+
-- Uncomment the following library declaration if using
26+
-- arithmetic functions with Signed or Unsigned values
27+
--use IEEE.NUMERIC_STD.ALL;
28+
29+
-- Uncomment the following library declaration if instantiating
30+
-- any Xilinx leaf cells in this code.
31+
--library UNISIM;
32+
--use UNISIM.VComponents.all;
33+
34+
entity FIFO is
35+
Generic (
36+
constant DATA_WIDTH : positive := 8;
37+
constant FIFO_DEPTH : positive := 156);
38+
Port (
39+
CLK : in STD_LOGIC;
40+
RST_N : in STD_LOGIC;
41+
WriteEn : in STD_LOGIC;
42+
DataIn : in STD_LOGIC_VECTOR (DATA_WIDTH - 1 downto 0);
43+
ReadEn : in STD_LOGIC;
44+
DataOut : out STD_LOGIC_VECTOR (DATA_WIDTH - 1 downto 0);
45+
Empty : out STD_LOGIC;
46+
Full : out STD_LOGIC
47+
);
48+
end FIFO;
49+
50+
architecture Behavioral of FIFO is
51+
52+
begin
53+
-- Memory Pointer Process
54+
fifo_proc : process (CLK)
55+
type FIFO_Memory is array (0 to FIFO_DEPTH - 1) of STD_LOGIC_VECTOR (DATA_WIDTH - 1 downto 0);
56+
variable Memory : FIFO_Memory;
57+
58+
variable Head : natural range 0 to FIFO_DEPTH - 1;
59+
variable Tail : natural range 0 to FIFO_DEPTH - 1;
60+
61+
variable Looped : boolean;
62+
begin
63+
if rising_edge(CLK) then
64+
if RST_N = '0' then
65+
Head := 0;
66+
Tail := 0;
67+
68+
Looped := false;
69+
70+
Full <= '0';
71+
Empty <= '1';
72+
else
73+
if (ReadEn = '1') then
74+
if ((Looped = true) or (Head /= Tail)) then
75+
-- Update data output
76+
DataOut <= Memory(Tail);
77+
78+
-- Update Tail pointer as needed
79+
if (Tail = FIFO_DEPTH - 1) then
80+
Tail := 0;
81+
82+
Looped := false;
83+
else
84+
Tail := Tail + 1;
85+
end if;
86+
87+
88+
end if;
89+
end if;
90+
91+
if (WriteEn = '1') then
92+
if ((Looped = false) or (Head /= Tail)) then
93+
-- Write Data to Memory
94+
Memory(Head) := DataIn;
95+
96+
-- Increment Head pointer as needed
97+
if (Head = FIFO_DEPTH - 1) then
98+
Head := 0;
99+
100+
Looped := true;
101+
else
102+
Head := Head + 1;
103+
end if;
104+
end if;
105+
end if;
106+
107+
-- Update Empty and Full flags
108+
if (Head = Tail) then
109+
if Looped then
110+
Full <= '1';
111+
else
112+
Empty <= '1';
113+
end if;
114+
else
115+
Empty <= '0';
116+
Full <= '0';
117+
end if;
118+
end if;
119+
end if;
120+
end process;
121+
122+
end Behavioral;

0 commit comments

Comments
 (0)