1 |
5 |
kfleming |
#//----------------------------------------------------------------------//
|
2 |
|
|
#// The MIT License
|
3 |
|
|
#//
|
4 |
|
|
#// Copyright (c) 2008 Kermin Fleming, kfleming@mit.edu
|
5 |
|
|
#//
|
6 |
|
|
#// Permission is hereby granted, free of charge, to any person
|
7 |
|
|
#// obtaining a copy of this software and associated documentation
|
8 |
|
|
#// files (the "Software"), to deal in the Software without
|
9 |
|
|
#// restriction, including without limitation the rights to use,
|
10 |
|
|
#// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
|
|
#// copies of the Software, and to permit persons to whom the
|
12 |
|
|
#// Software is furnished to do so, subject to the following conditions:
|
13 |
|
|
#//
|
14 |
|
|
#// The above copyright notice and this permission notice shall be
|
15 |
|
|
#// included in all copies or substantial portions of the Software.
|
16 |
|
|
#//
|
17 |
|
|
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18 |
|
|
#// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
19 |
|
|
#// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20 |
|
|
#// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21 |
|
|
#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22 |
|
|
#// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
23 |
|
|
#// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
24 |
|
|
#// OTHER DEALINGS IN THE SOFTWARE.
|
25 |
|
|
#//----------------------------------------------------------------------//
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
default : all
|
29 |
|
|
|
30 |
|
|
basedir = ../
|
31 |
|
|
bsvlibdir = ../../../bsclib
|
32 |
|
|
verilogdir = ./
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
#--------------------------------------------------------------------
|
36 |
|
|
# Sources
|
37 |
|
|
#--------------------------------------------------------------------
|
38 |
|
|
|
39 |
|
|
# Library components
|
40 |
|
|
|
41 |
|
|
bsvclibdir = $(MIT6375_HOME)/install/bsvclib
|
42 |
|
|
bsvclibsrcs = \
|
43 |
|
|
|
44 |
|
|
# Bluespec sources
|
45 |
|
|
|
46 |
|
|
toplevel_module = mkTestBench
|
47 |
|
|
|
48 |
|
|
srcdir = $(basedir)
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
fpgasrcs = \
|
52 |
|
|
$(srcdir)/BRAMFIFO.bsv \
|
53 |
|
|
$(srcdir)/mkTestBench.bsv \
|
54 |
|
|
$(srcdir)/top.v \
|
55 |
|
|
$(srcdir)/BRAMFIFOF.v
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
#--------------------------------------------------------------------
|
60 |
|
|
# Build rules
|
61 |
|
|
#--------------------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
BSC_COMP = bsc
|
64 |
|
|
#BSC_OPTS = -u -show-module-use - -keep-fires -aggressive-conditions \
|
65 |
|
|
# -relax-method-earliness -relax-method-urgency -v
|
66 |
|
|
|
67 |
|
|
BSC_OPTS_SIM = +RTS -K400000k --RTS -u -v -sim -aggressive-conditions
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
BSC_OPTS_VERILOG = +RTS -K400000k --RTS -u -v -verilog -aggressive-conditions -dschedule
|
71 |
|
|
|
72 |
|
|
BSIM_OPTS = +RTS -K400000k --RTS -sim
|
73 |
|
|
|
74 |
|
|
# Copy over te bluespec source
|
75 |
|
|
|
76 |
|
|
$(notdir $(fpgasrcs)) : % : $(srcdir)/%
|
77 |
|
|
cp $< .
|
78 |
|
|
|
79 |
|
|
$(notdir $(bsvclibsrcs)) : % : $(bsvclibdir)/%
|
80 |
|
|
cp $< .
|
81 |
|
|
|
82 |
|
|
# Run the bluespec compiler
|
83 |
|
|
|
84 |
|
|
bsv_TH_vsrc = $(toplevel_module).v
|
85 |
|
|
$(bsv_TH_vsrc) $(bsv_lib_use) : $(notdir $(fpgasrcs) $(bsvclibsrcs))
|
86 |
|
|
$(BSC_COMP) $(BSC_OPTS_SIM) -g $(toplevel_module) $(toplevel_module).bsv > out.log
|
87 |
|
|
|
88 |
|
|
bsv : $(toplevel_module).v
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
blue_sim: $(bsv_TH_vsrc)
|
92 |
|
|
$(BSC_COMP) $(BSIM_OPTS) -e $(toplevel_module) *.ba > out.txt
|
93 |
|
|
|
94 |
|
|
verilog: $(notdir $(fpgasrcs) $(bsvclibsrcs))
|
95 |
|
|
$(BSC_COMP) $(BSC_OPTS_VERILOG) -g $(toplevel_module) $(toplevel_module).bsv > out.log
|
96 |
|
|
|
97 |
|
|
verilog_exec: verilog
|
98 |
|
|
iverilog -y$(bsvlibdir) -y$(verilogdir) *.v
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
# Create a schedule file
|
102 |
|
|
|
103 |
|
|
schedule_rpt = schedule.rpt
|
104 |
|
|
$(schedule_rpt) : $(notdir $(fpgasrcs) $(bsvclibsrcs))
|
105 |
|
|
rm -rf *.v
|
106 |
|
|
$(BSC_COMP) $(BSC_OPTS_SIM) -show-schedule -show-rule-rel \* \* -g $(toplevel_module) \
|
107 |
|
|
$(toplevel_module).bsv >& $(schedule_rpt)
|
108 |
|
|
|
109 |
|
|
junk += $(notdir $(fpgasrcs) ) $(notdir $(bsvclibsrcs)) \
|
110 |
|
|
$(schedule_rpt) *.use *.bi *.bo *.v bsc.log
|
111 |
|
|
|
112 |
|
|
#--------------------------------------------------------------------
|
113 |
|
|
# Default make target
|
114 |
|
|
#--------------------------------------------------------------------
|
115 |
|
|
|
116 |
|
|
all : verilog_exec
|
117 |
|
|
|
118 |
|
|
#--------------------------------------------------------------------
|
119 |
|
|
# Clean up
|
120 |
|
|
#--------------------------------------------------------------------
|
121 |
|
|
|
122 |
|
|
clean :
|
123 |
|
|
rm -rf $(junk) *~ \#* *.cxx *.o *.h *.ba
|