1 |
2 |
abhiag |
# //----------------------------------------------------------------------//
|
2 |
|
|
# // The MIT License
|
3 |
|
|
# //
|
4 |
|
|
# // Copyright (c) 2008 Abhinav Agarwal, Alfred Man Cheuk Ng
|
5 |
|
|
# // Contact: abhiag@gmail.com
|
6 |
|
|
# //
|
7 |
|
|
# // Permission is hereby granted, free of charge, to any person
|
8 |
|
|
# // obtaining a copy of this software and associated documentation
|
9 |
|
|
# // files (the "Software"), to deal in the Software without
|
10 |
|
|
# // restriction, including without limitation the rights to use,
|
11 |
|
|
# // copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 |
|
|
# // copies of the Software, and to permit persons to whom the
|
13 |
|
|
# // Software is furnished to do so, subject to the following conditions:
|
14 |
|
|
# //
|
15 |
|
|
# // The above copyright notice and this permission notice shall be
|
16 |
|
|
# // included in all copies or substantial portions of the Software.
|
17 |
|
|
# //
|
18 |
|
|
# // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19 |
|
|
# // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
20 |
|
|
# // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21 |
|
|
# // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
22 |
|
|
# // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
23 |
|
|
# // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
24 |
|
|
# // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
25 |
|
|
# // OTHER DEALINGS IN THE SOFTWARE.
|
26 |
|
|
# //----------------------------------------------------------------------//
|
27 |
|
|
|
28 |
|
|
#=======================================================================
|
29 |
|
|
# Makefile for Reed Solomon decoder
|
30 |
|
|
#-----------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
default : mkTestBench
|
33 |
|
|
|
34 |
|
|
#--------------------------------------------------------------------
|
35 |
|
|
# Sources
|
36 |
|
|
#--------------------------------------------------------------------
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
# Bluespec sources
|
41 |
|
|
|
42 |
|
|
srcdir = .
|
43 |
|
|
sim_srcdir = $(srcdir)/simulate
|
44 |
|
|
|
45 |
|
|
toplevel_module = mkTestBench
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
bsvsrcs = \
|
49 |
|
|
$(srcdir)/RSParameters.bsv \
|
50 |
|
|
$(srcdir)/GFTypes.bsv \
|
51 |
|
|
$(srcdir)/GFArith.bsv \
|
52 |
|
|
$(srcdir)/MFIFO.bsv \
|
53 |
|
|
$(srcdir)/SyndromeParallel.bsv \
|
54 |
|
|
$(srcdir)/Berlekamp.bsv \
|
55 |
|
|
$(srcdir)/ChienSearch.bsv \
|
56 |
|
|
$(srcdir)/ErrorMagnitude.bsv \
|
57 |
|
|
$(srcdir)/ErrorCorrector.bsv \
|
58 |
|
|
$(srcdir)/mkReedSolomon.bsv \
|
59 |
|
|
$(srcdir)/file_interface.cpp \
|
60 |
|
|
$(srcdir)/mkTestBench.bsv \
|
61 |
|
|
$(srcdir)/funcunit.bsv
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
sim_bsvsrcs = \
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
cppdir = $(srcdir)
|
68 |
|
|
|
69 |
|
|
cppsrcs = $(cppdir)/preproc.cpp
|
70 |
|
|
|
71 |
|
|
#--------------------------------------------------------------------
|
72 |
|
|
# Build rules
|
73 |
|
|
#--------------------------------------------------------------------
|
74 |
|
|
|
75 |
|
|
# compile & run the preproc to generate the GF inverse logic.
|
76 |
|
|
|
77 |
|
|
preproc.o : $(notdir $(cppsrcs))
|
78 |
|
|
$(CXX) -c -o preproc.o preproc.cpp
|
79 |
|
|
|
80 |
|
|
preproc : preproc.o
|
81 |
|
|
$(CXX) -o preproc preproc.o
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
GFInv.bsv : preproc $(notdir $(bsvsrcs))
|
85 |
|
|
./preproc RSParameters.bsv GFInv.bsv
|
86 |
|
|
|
87 |
|
|
BSC_COMP = bsc
|
88 |
|
|
|
89 |
|
|
BSC_FLAGS = -u -aggressive-conditions -keep-fires -no-show-method-conf \
|
90 |
|
|
-steps-warn-interval 200000 -steps-max-intervals 10 -show-schedule +RTS -K4000M -RTS
|
91 |
|
|
|
92 |
|
|
BSC_VOPTS = -elab -verilog
|
93 |
|
|
|
94 |
|
|
BSC_BAOPTS = -sim
|
95 |
|
|
|
96 |
|
|
# run gcc
|
97 |
|
|
|
98 |
|
|
file_interface.o : file_interface.cpp
|
99 |
|
|
gcc -c -DDATA_FILE_PATH=\"./input.dat\" \
|
100 |
|
|
-DOUT_DATA_FILE_PATH=\"./output.dat\" \
|
101 |
|
|
file_interface.cpp
|
102 |
|
|
|
103 |
|
|
# Run the bluespec compiler
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
mkTestBench.ba : GFInv.bsv $(notdir $(bsvsrcs) $(sim_bsvsrcs))
|
107 |
|
|
$(BSC_COMP) $(BSC_FLAGS) $(BSC_VOPTS) mkReedSolomon.bsv
|
108 |
|
|
$(BSC_COMP) $(BSC_FLAGS) $(BSC_BAOPTS) -g $(toplevel_module) $(toplevel_module).bsv
|
109 |
|
|
|
110 |
|
|
mkTestBench : mkTestBench.ba file_interface.o
|
111 |
|
|
$(BSC_COMP) $(BSC_BAOPTS) -e $(toplevel_module) *.ba file_interface.o
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
# Create a schedule file
|
115 |
|
|
|
116 |
|
|
schedule_rpt = schedule.rpt
|
117 |
|
|
$(schedule_rpt) : $(notdir $(bsvsrcs) $(bsvclibsrcs))
|
118 |
|
|
rm -rf *.v
|
119 |
|
|
$(BSC_COMP) $(BSC_FLAGS) $(BSC_BAOPTS) -show-schedule -show-rule-rel \* \* -g $(toplevel_module) $(toplevel_module).bsv
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
#--------------------------------------------------------------------
|
123 |
|
|
# Clean up
|
124 |
|
|
#--------------------------------------------------------------------
|
125 |
|
|
|
126 |
|
|
junk += $(schedule_rpt) *.use *.bi *.bo *.v bsc.log \
|
127 |
|
|
diff.out *.sched directc.*
|
128 |
|
|
|
129 |
|
|
.PHONY: clean
|
130 |
|
|
|
131 |
|
|
clean :
|
132 |
|
|
rm -rf $(junk) *~ \#* *.h *.o *.cxx *.ba a.out preproc
|
133 |
|
|
|