OpenCores
URL https://opencores.org/ocsvn/bitserial/bitserial/trunk

Subversion Repositories bitserial

[/] [bitserial/] [trunk/] [makefile] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 howe.r.j.8
CC=gcc
2
CFLAGS=-Wall -Wextra -std=c99 -O2
3
USB?=/dev/ttyUSB0
4
BAUD?=115200
5
DIFF?=vimdiff
6
#BAUD?=9600
7
 
8
.PHONY: all run diff simulation viewer clean documentation
9
 
10
all: bit simulation
11
 
12
run: bit bit.hex
13
        ./bit bit.hex
14
 
15
talk:
16
        picocom --omap delbs -e b -b ${BAUD} ${USB}
17
 
18
simulation: tb.ghw
19
 
20
viewer: tb.ghw signals.tcl
21
        gtkwave -S signals.tcl -f $< > /dev/null 2>&1 &
22
 
23
documentation: readme.htm
24
 
25
%.htm: %.md
26
        pandoc $< -o $@
27
 
28
bit.hex bit.bin: bit.fth bit
29
        gforth $<
30
 
31
bit: bit.c
32
        ${CC} ${CFLAGS} $< -o $@
33
 
34
%.o: %.vhd
35
        ghdl -a -g $<
36
 
37
uart.o: uart.vhd util.o
38
 
39
peripherals.o: peripherals.vhd uart.o util.o
40
 
41
top.o: top.vhd peripherals.o bit.o util.o uart.o
42
 
43
tb.o: tb.vhd bit.o peripherals.o top.o
44
 
45
tb: tb.o bit.o peripherals.o top.o
46
        ghdl -e $@
47
 
48
tb.ghw: tb tb.conf bit.hex
49
        ghdl -r $< --wave=$<.ghw --max-stack-alloc=16384 --ieee-asserts=disable
50
 
51
SOURCES = \
52
        top.vhd \
53
        bit.vhd \
54
        uart.vhd \
55
        util.vhd \
56
        peripherals.vhd
57
 
58
OBJECTS = ${SOURCES:.vhd=.o}
59
 
60
bitfile: design.bit
61
 
62
reports:
63
        @[ -d reports    ]    || mkdir reports
64
tmp:
65
        @[ -d tmp        ]    || mkdir tmp
66
tmp/_xmsgs:
67
        @[ -d tmp/_xmsgs ]    || mkdir tmp/_xmsgs
68
 
69
tmp/top.prj: tmp
70
        @rm -f tmp/top.prj
71
        @( \
72
            for f in $(SOURCES); do \
73
                echo "vhdl work \"$$f\""; \
74
            done; \
75
            echo "vhdl work \"top.vhd\"" \
76
        ) > tmp/top.prj
77
 
78
tmp/top.lso: tmp
79
        @echo "work" > tmp/top.lso
80
 
81
tmp/top.xst: tmp tmp/_xmsgs tmp/top.lso tmp/top.lso
82
        @( \
83
            echo "set -tmpdir \"tmp\""; \
84
            echo "set -xsthdpdir \"tmp\""; \
85
            echo "run"; \
86
            echo "-lso tmp/top.lso"; \
87
            echo "-ifn tmp/top.prj"; \
88
            echo "-ofn top"; \
89
            echo "-p xc6slx16-csg324-3"; \
90
            echo "-top top"; \
91
            echo "-opt_mode area"; \
92
            echo "-opt_level 2" \
93
        ) > tmp/top.xst
94
 
95
synthesis: bit.hex reports tmp tmp/_xmsgs tmp/top.prj tmp/top.xst
96
        @echo "Synthesis running..."
97
        @${TIME} xst -intstyle silent -ifn tmp/top.xst -ofn reports/xst.log
98
        @mv _xmsgs/* tmp/_xmsgs
99
        @rmdir _xmsgs
100
        @mv top_xst.xrpt tmp
101
        @grep "ERROR\|WARNING" reports/xst.log | \
102
         grep -v "WARNING.*has a constant value.*This FF/Latch will be trimmed during the optimization process." | \
103
         cat
104
        @grep ns reports/xst.log | grep 'Clock period'
105
 
106
implementation: reports tmp
107
        @echo "Implementation running..."
108
 
109
        @[ -d tmp/xlnx_auto_0_xdb ] || mkdir tmp/xlnx_auto_0_xdb
110
 
111
        @${TIME} ngdbuild -intstyle silent -quiet -dd tmp -uc top.ucf -p xc6slx16-csg324-3 top.ngc top.ngd
112
        @mv top.bld reports/ngdbuild.log
113
        @mv _xmsgs/* tmp/_xmsgs
114
        @rmdir _xmsgs
115
        @mv xlnx_auto_0_xdb/* tmp
116
        @rmdir xlnx_auto_0_xdb
117
        @mv top_ngdbuild.xrpt tmp
118
 
119
        @${TIME} map -intstyle silent -detail -p xc6slx16-csg324-3 -convert_bram8 -pr b -c 100 -w -o top_map.ncd top.ngd top.pcf
120
        @mv top_map.mrp reports/map.log
121
        @mv _xmsgs/* tmp/_xmsgs
122
        @rmdir _xmsgs
123
        @mv top_usage.xml top_summary.xml top_map.map top_map.xrpt tmp
124
 
125
        @${TIME} par -intstyle silent -w -ol std top_map.ncd top.ncd top.pcf
126
        @mv top.par reports/par.log
127
        @mv top_pad.txt reports/par_pad.txt
128
        @mv _xmsgs/* tmp/_xmsgs
129
        @rmdir _xmsgs
130
        @mv par_usage_statistics.html top.ptwx top.pad top_pad.csv top.unroutes top.xpi top_par.xrpt tmp
131
 
132
design.bit: reports tmp/_xmsgs
133
        @echo "Generate bitfile running..."
134
        @touch webtalk.log
135
        @${TIME} bitgen -intstyle silent -w top.ncd
136
        @mv top.bit design.bit
137
        @mv top.bgn reports/bitgen.log
138
        @mv _xmsgs/* tmp/_xmsgs
139
        @rmdir _xmsgs
140
        @sleep 5
141
        @mv top.drc top_bitgen.xwbt top_usage.xml top_summary.xml webtalk.log tmp
142
        @grep -i '\(warning\|clock period\)' reports/xst.log
143
 
144
upload:
145
        djtgcfg prog -d Nexys3 -i 0 -f design.bit
146
 
147
design: clean simulation synthesis implementation bitfile
148
 
149
postsyn:
150
        @netgen -w -ofmt vhdl -sim ${NETLIST}.ngc post_synthesis.vhd
151
        @netgen -w -ofmt vhdl -sim ${NETLIST}.ngd post_translate.vhd
152
        @netgen  -pcf ${NETLIST}.pcf -w -ofmt vhdl -sim ${NETLIST}.ncd post_map.vhd
153
 
154
clean:
155
        git clean -fdx .
156
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.