-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
executable file
·526 lines (392 loc) · 15.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
#Verilog
# Making verilog makefile
# Makefile to simulate Verilog HDL designs under OSX.
###
######## [email protected]
###
# Makefile logic:
# To create this file you need these files:
# $ @ replace left
# $ ^ right
#******************************************************************************
# MARKS
#******************************************************************************
# 1. For mux 2:1 ---------- mux21
# 2. For mux 4:1 ---------- mux41
# 3. For mux 4:2 ---------- mux42
# 4. For parallel to serial -------- ptos
# 5. For parallel to serial IDLE -------- ptosidle
# 6. For demux 1:2 -------- demux12
# 7. For demux 1:4 -------- demux14
# 8. For demux 2:4 -------- demux24
# 9. For serial to parallel ----- stop
# 10. For serial to parallel IDLE ----- stopidle
# 11. For recirculation idle -------- reciridle
# 12. For TX -------- tx
# 13. For RX -------- rx
# 14. For Phy - Physical PCIe --------- phy
all:
#******************************************************************************
# TARGETS
#******************************************************************************
### YOSYS use $make y<mark>
# To generate the structural design of the
# behavioral design automatically through synthesis
#It is defined as a roughly RTL (Register Transfer Level)
#synthesizer that allows you to convert the HDL (Hardware
# Description Language) code into an electronic scheme.
# Coming to show the components connected to each other what
# is usually called RTL network list which is associated with
# the level of registry transfer. Considering that what it allows
# is to model a synchronous digital circuit in terms of digital signal
# flow (this being data) relating it to the hardware registers and the
# logical operations that are carried out in each signal.
### SED use $make r<mark>
# Replaces on the synthesized file the name module,
# because for making the stuctural decription we use the
# behavioral on yosys
#### IVERILOG use $make v<mark>
# It is defined as an HDL (Hardware Description Language),
# this being a modeled hardware language, that is, it allows
# describing a simulation of digital circuits. It can be seen
# as the tool that allows to provide the specifications to carry
# out a physical component which is being modeled.
# Example of command:
# iverilog -o ./vvp/TestBench_21_2.vvp ./TestBenchAUTONST/TestBench_21_2.v
# Its automatic, because each time you are asked for a vvp
# you need one with con.v
### GTKWAVE use $make gtkwave<mark>
# We can define it as a visualization of simulation results
# where one of its advantages is that by means of a visualization
# of signal waves we can understand the problem when it
# is found by using the testbench.
#******************************************************************************
# Modify this part with your own folders paths.
DIAGRAMS_GENERATED = ./diagrams_generated/
LIB = ./lib/
LOG_TXT = ./log_txt/
SRC = ./src/
_MUX21 = mux2x1_behav.v
_MUX41 = mux4x1_behav.v
_MUX42 = mux4x2_behav.v
_PTOS = paralelltoserial.v
_PTOSIDLE = paralelltoserial_IDLE.v
_STOP = serieparalelo.v
_STOPIDLE = serie_paralelo_idle.v
_DEMUX12 = demux1x2_behav.v
_DEMUX14 = demux1x4_behav.v
_DEMUX24 = demux2x4_behav.v
_RECIRIDLE = recir_idle.v
_PHY_TX = phy_tx.v
_PHY_RX = phy_rx.v
_PHY = phy.v
SYN = ./syn/
_SMUX21 = mux2x1_syn.v
_SMUX41 = mux4x1_syn.v
_SMUX42 = mux4x2_syn.v
_SPTOS = paralelltoserial_syn.v
_SPTOSIDLE = paralelltoserial_IDLE_syn.v
_SSTOP = serieparalelo_syn.v
_SSTOPIDLE = serie_paralelo_idle_syn.v
_SDEMUX12 = demux1x2_behav_syn.v
_SDEMUX14 = demux1x4_behav_syn.v
_SDEMUX24 = demux2x4_behav_syn.v
_SRECIRIDLE = recir_idle_syn.v
_SPHY_TX = phy_tx_syn.v
_SPHY_RX = phy_rx_syn.v
_SPHY = phy_syn.v
TESTBENCHES = ./testbenches/
_TB_MUX21 = tb_mux21.v
_TB_MUX41 = tb_mux41.v
_TB_MUX42 = tb_mux42.v
_TB_PTOS = tb_ptos.v
_TB_PTOSIDLE = tb_ptos_IDLE.v
_TB_STOP = tb_stop.v
_TB_STOPIDLE = tb_stop_idle.v
_TB_DEMUX12 = tb_demux12.v
_TB_DEMUX14 = tb_demux14.v
_TB_DEMUX24 = tb_demux24.v
_TB_RECIRIDLE = tb_recir_idle.v
_TB_PHY_TX = tb_phy_tx.v
_TB_PHY_RX = tb_phy_rx.v
_TB_PHY = tb_phy.v
TESTERS = ./testers/
_T_MUX21 = t_mux21.v
_T_MUX41 = t_mux41.v
_T_MUX42 = t_mux42.v
_T_PTOS = t_ptos.v
_T_PTOSIDLE = t_ptos_idle.v
_T_STOP = t_stop.v
_T_STOPIDLE = t_stop_idle.v
_T_DEMUX12 = t_demux12.v
_T_DEMUX14 = t_demux14.v
_T_DEMUX24 = t_demux24.v
_T_RECIRIDLE = t_recir_idle.v
_T_PHY_TX = t_phy_tx.v
_T_PHY_RX = t_phy_rx.v
_T_PHY = t_phy.v
_VCD_MUX21 = mux21.vcd
_VCD_MUX41 = mux41.vcd
_VCD_MUX42 = mux42.vcd
_VCD_PTOS = ptos.vcd
_VCD_PTOSIDLE = ptos_idle.vcd
_VCD_STOP = stop.vcd
_VCD_STOPIDLE = stopidle.vcd
_VCD_DEMUX12 = demux12.vcd
_VCD_DEMUX14 = demux14.vcd
_VCD_DEMUX24 = demux24.vcd
_VCD_RECIRIDLE = recir_idle.vcd
_VCD_PHY_TX = phy_tx.vcd
_VCD_PHY_RX = phy_rx.vcd
_VCD_PHY = phy.vcd
OVVP = ./vvp/
_VVP_MUX21 = mux21.vvp
_VVP_MUX41 = mux41.vvp
_VVP_MUX42 = mux42.vvp
_VVP_PTOS = ptos.vvp
_VVP_PTOSIDLE = ptos_idle.vvp
_VVP_STOP = stop.vvp
_VVP_STOPIDLE = stopdile.vvp
_VVP_DEMUX12 = demux12.vvp
_VVP_DEMUX14 = demux14.vvp
_VVP_DEMUX24 = demux24.vvp
_VVP_RECIRIDLE = recir_idle.vvp
_VVP_PHY_TX = phy_tx.vvp
_VVP_PHY_RX = phy_rx.vvp
_VVP_PHY = phy.vvp
YOSYS = ./yosys/
_Y_MUX21 = mux21_y.ys
_Y_MUX41 = mux41_y.ys
_Y_MUX42 = mux42_y.ys
_Y_PTOS = ptos_y.ys
_Y_PTOSIDLE = ptos_idle_y.ys
_Y_STOP = stop_y.ys
_Y_STOPIDLE = stop_idle_y.ys
_Y_DEMUX12 = demux12_y.ys
_Y_DEMUX14 = demux14_y.ys
_Y_DEMUX24 = demux24_y.ys
_Y_RECIRIDLE = recir_idle_y.ys
_Y_PHY_TX = phy_tx_y.ys
_Y_PHY_RX = phy_rx_y.ys
_Y_PHY = phy_y.ys
#******************************************************************************
# # IVERILOG
# %.vvp: %.v
# iverilog -o $@ $^
#******************************************************************************
#### MUX 2:1
#******************************************************************************
ymux21:
yosys $(YOSYS)$(_Y_MUX21)
rmux21:
sed -i ' s/mux2x1_behav/mux2x1_struct/' $(SYN)$(_SMUX21)
vmux21:
iverilog -o $(OVVP)$(_VVP_MUX21) $(TESTBENCHES)$(_TB_MUX21)
vvp $(OVVP)$(_VVP_MUX21) > $(LOG_TXT)$(_VVP_MUX21)_log.txt
#target phony
.PHONY: gtkwavemux21
gtkwavemux21:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_MUX21)
#******************************************************************************
#### MUX 4:1
#******************************************************************************
ymux41:
yosys $(YOSYS)$(_Y_MUX41)
rmux41:
sed -i 's/mux4x1_behav/mux4x1_struct/; s/mux4x2_behav/mux4x2_struct/; s/mux2x1_behav/mux2x1_struct/; s/ff1in1o/ff1in1o_struct/; s/ff2in2o/ff2in2o_struct/; s/ff4in4o/ff4in4o_struct/; s/ff4in4ovalid/ff4in4ovalid_struct/' $(SYN)$(_SMUX41)
vmux41:
iverilog -o $(OVVP)$(_VVP_MUX41) $(TESTBENCHES)$(_TB_MUX41)
vvp $(OVVP)$(_VVP_MUX41) > $(LOG_TXT)$(_VVP_MUX41)_log.txt
#target phony
.PHONY: gtkwavemux41
gtkwavemux41:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_MUX41)
#******************************************************************************
#### MUX 4:2
#******************************************************************************
ymux42:
yosys $(YOSYS)$(_Y_MUX42)
rmux42:
sed -i 's/mux2x1_behav/mux2x1_struct/; s/mux4x2_behav/mux4x2_struct/' $(SYN)$(_SMUX42)
vmux42:
iverilog -o $(OVVP)$(_VVP_MUX42) $(TESTBENCHES)$(_TB_MUX42)
vvp $(OVVP)$(_VVP_MUX42) > $(LOG_TXT)$(_VVP_MUX42)_log.txt
#target phony
.PHONY: gtkwavemux42
gtkwavemux42:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_MUX42)
#******************************************************************************
#### PARALLEL TO SERIAL
#******************************************************************************
yptos:
yosys $(YOSYS)$(_Y_PTOS)
rptos:
sed -i 's/paralelo_a_serial/paralelo_a_serial_syn/' $(SYN)$(_SPTOS)
vptos:
iverilog -o $(OVVP)$(_VVP_PTOS) $(TESTBENCHES)$(_TB_PTOS)
vvp $(OVVP)$(_VVP_PTOS) > $(LOG_TXT)$(_VVP_PTOS)_log.txt
#target phony
.PHONY: gtkwaveptos
gtkwaveptos:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_PTOS)
#******************************************************************************
#### PARALLEL TO SERIAL IDLE
#******************************************************************************
yptosidle:
yosys $(YOSYS)$(_Y_PTOSIDLE)
rptosidle:
sed -i 's/paralelo_a_serial_IDLE/paralelo_a_serial_IDLE_syn' $(SYN)$(_SPTOSIDLE)
vptosidle:
iverilog -o $(OVVP)$(_VVP_PTOSIDLE) $(TESTBENCHES)$(_TB_PTOSIDLE)
vvp $(OVVP)$(_VVP_PTOSIDLE) > $(LOG_TXT)$(_VVP_PTOSIDLE)_log.txt
#target phony
.PHONY: gtkwaveptosidle
gtkwaveptosidle:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_PTOSIDLE)
#******************************************************************************
#### SERIAL TO PARALLEL
#******************************************************************************
ystop:
yosys $(YOSYS)$(_Y_STOP)
rstop:
sed -i 's/serieparalelo/serieparalelo_syn/' $(SYN)$(_SSTOP)
vstop:
iverilog -o $(OVVP)$(_VVP_STOP) $(TESTBENCHES)$(_TB_STOP)
vvp $(OVVP)$(_VVP_STOP) > $(LOG_TXT)$(_VVP_STOP)_log.txt
#target phony
.PHONY: gtkwavestop
gtkwavestop:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_STOP)
#******************************************************************************
#### SERIAL TO PARALLEL IDLE
#******************************************************************************
ystopidle:
yosys $(YOSYS)$(_Y_STOPIDLE)
rstopidle:
sed -i 's/serieparalelo_IDLE/serieparalelo_IDLE_syn/' $(SYN)$(_SSTOPIDLE)
vstopidle:
iverilog -o $(OVVP)$(_VVP_STOPIDLE) $(TESTBENCHES)$(_TB_STOPIDLE)
vvp $(OVVP)$(_VVP_STOPIDLE) > $(LOG_TXT)$(_VVP_STOPIDLE)_log.txt
#target phony
.PHONY: gtkwavestopidle
gtkwavestopidle:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_STOPIDLE)
#******************************************************************************
#### DEMUX 1:2
#******************************************************************************
ydemux12:
yosys $(YOSYS)$(_Y_DEMUX12)
rdemux12:
sed -i 's/demux1x2_behav/demux1x2_behav_syn/' $(SYN)$(_SDEMUX12)
vdemux12:
iverilog -o $(OVVP)$(_VVP_DEMUX12) $(TESTBENCHES)$(_TB_DEMUX12)
vvp $(OVVP)$(_VVP_DEMUX12) > $(LOG_TXT)$(_VVP_DEMUX12)_log.txt
#target phony
.PHONY: gtkwavedemux12
gtkwavedemux12:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_DEMUX12)
`include "./src/ff2in2o.v"
`include "./src/ff4in4o.v"
`include "./src/ff4in4ovalid.v"
#******************************************************************************
#### DEMUX 1:4
#******************************************************************************
ydemux14:
yosys $(YOSYS)$(_Y_DEMUX14)
rdemux14:
sed -i 's/demux1x2_behav/demux1x2_behav_syn/g; s/demux1x4_behav/demux1x4_behav_syn/g' $(SYN)$(_SDEMUX14)
sed -i 's/ff2in2o/ff2in2o_syn/g; s/ff4in4o/ff2in2o_syn/g; s/ff4in4ovalid/ff4in4ovalid_syn/g' $(SYN)$(_SDEMUX14)
vdemux14:
iverilog -o $(OVVP)$(_VVP_DEMUX14) $(TESTBENCHES)$(_TB_DEMUX14)
vvp $(OVVP)$(_VVP_DEMUX14) > $(LOG_TXT)$(_VVP_DEMUX12)_log.txt
#target phony
.PHONY: gtkwavedemux14
gtkwavedemux14:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_DEMUX14)
#******************************************************************************
#### DEMUX 2:4
#******************************************************************************
ydemux24:
yosys $(YOSYS)$(_Y_DEMUX14)
rdemux24:
sed -i 's/demux1x2_behav/demux1x2_behav_syn/g; s/demux2x4_behav/demux2x4_behav_syn/g ' $(SYN)$(_SDEMUX24)
vdemux24:
iverilog -o $(OVVP)$(_VVP_DEMUX24) $(TESTBENCHES)$(_TB_DEMUX24)
vvp $(OVVP)$(_VVP_DEMUX24) > $(LOG_TXT)$(_VVP_DEMUX24)_log.txt
#target phony
.PHONY: gtkwavedemux24
gtkwavedemux24:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_DEMUX24)
#******************************************************************************
#### RECIRCULATION IDLE
#******************************************************************************
yreciridle:
yosys $(YOSYS)$(_Y_RECIRIDLE)
rreciridle:
sed -i 's/recir_idle/recir_idle_syn/' $(SYN)$(_SRECIRIDLE)
vreciridle:
iverilog -o $(OVVP)$(_VVP_RECIRIDLE) $(TESTBENCHES)$(_TB_RECIRIDLE)
vvp $(OVVP)$(_VVP_RECIRIDLE) > $(LOG_TXT)$(_VVP_RECIRIDLE)_log.txt
#target phony
.PHONY: gtkwavereciridle
gtkwavereciridle:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_RECIRIDLE)
#******************************************************************************
#### PHY TX
#******************************************************************************
ytx:
yosys $(YOSYS)$(_Y_PHY_TX)
rtx:
sed -i 's/ff1in1o/ff1in1o_syn/g; s/ff2in2o/ff2in2o_syn/g; s/ff4in4o/ff4in4o_syn/g' $(SYN)$(_SPHY_TX)
sed -i 's/mux2x1_behav/mux2x1_behav_syn/g; s/mux4x1_behav/mux4x1_behav_syn/g; s/mux4x2_behav/mux4x2_behav_syn/g' $(SYN)$(_SPHY_TX)
sed -i 's/paralelo_a_serial/paralelo_a_serial_syn/g; s/phy_tx_b/phy_tx_b_syn/g' $(SYN)$(_SPHY_TX)
sed -i 's/serieparalelo_IDLE/serieparalelo_IDLE_syn/g; s/recir_idle/recir_idle_syn/g' $(SYN)$(_SPHY_TX)
vtx:
iverilog -o $(OVVP)$(_VVP_PHY_TX) $(TESTBENCHES)$(_TB_PHY_TX)
vvp $(OVVP)$(_VVP_PHY_TX) > $(LOG_TXT)$(_VVP_PHY_TX)_log.txt
#target phony
.PHONY: gtkwavetx
gtkwavetx:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_PHY_TX)
#******************************************************************************
#### PHY RX
#******************************************************************************
yrx:
yosys $(YOSYS)$(_Y_PHY_RX)
rrx:
sed -i 's/ff2in2o/ff2in2o_syn/g; s/ff4in4o/ff4in4o_syn/g; s/ff4in4ovalid/ff4in4ovalid_syn/g ' $(SYN)$(_SPHY_RX)
sed -i 's/demux1x2_behav/demux1x2_behav_syn/g; s/demux1x4_behav/demux1x4_behav_syn/g; s/demux2x4_behav/demux2x4_behav_syn/g' $(SYN)$(_SPHY_RX)
sed -i 's/paralelo_a_serial_IDLE/paralelo_a_serial_IDLE_syn/g; s/serieparalelo/serieparalelo_syn/g; s/phy_rx/phy_rx_syn/g' $(SYN)$(_SPHY_RX)
vrx:
iverilog -o $(OVVP)$(_VVP_PHY_RX) $(TESTBENCHES)$(_TB_PHY_RX)
vvp $(OVVP)$(_VVP_PHY_RX) > $(LOG_TXT)$(_VVP_PHY_RX)_log.txt
#target phony
.PHONY: gtkwaverx
gtkwavetrx:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_PHY_RX)
#******************************************************************************
#### PHY
#******************************************************************************
yphy:
yosys $(YOSYS)$(_Y_PHY)
rphy:
sed -i 's/ff1in1o/ff1in1o_syn/g; s/ff2in2o/ff2in2o_syn/g; s/ff4in4o/ff4in4o_syn/g' $(SYN)$(_SPHY)
sed -i 's/mux2x1_behav/mux2x1_behav_syn/g; s/mux4x1_behav/mux4x1_behav_syn/g; s/mux4x2_behav/mux4x2_behav_syn/g' $(SYN)$(_SPHY)
sed -i 's/paralelo_a_serial/paralelo_a_serial_syn/g; s/phy_tx_b/phy_tx_b_syn/g' $(SYN)$(_SPHY)
sed -i 's/serieparalelo_IDLE/serieparalelo_IDLE_syn/g; s/recir_idle/recir_idle_syn/g' $(SYN)$(_SPHY)
sed -i 's/demux1x2_behav/demux1x2_behav_syn/g; s/demux1x4_behav/demux1x4_behav_syn/g; s/demux2x4_behav/demux2x4_behav_syn/g' $(SYN)$(_SPHY)
sed -i 's/paralelo_a_serial_IDLE/paralelo_a_serial_IDLE_syn/g; s/serieparalelo/serieparalelo_syn/g; s/phy_rx/phy_rx_syn/g' $(SYN)$(_SPHY)
sed -i 's/phy/phy_syn/g' $(SYN)$(_SPHY)
vphy:
iverilog -o $(OVVP)$(_VVP_PHY) $(TESTBENCHES)$(_TB_PHY)
vvp $(OVVP)$(_VVP_PHY) > $(LOG_TXT)$(_VVP_PHY)_log.txt
#target phony
.PHONY: gtkwavephy
gtkwavephy:
/Applications/gtkwave.app/Contents/Resources/bin/gtkwave $(_VCD_PHY)
#******************************************************************************
############ CLEAN FOR ALL
#******************************************************************************
.PHONY: clean
clean:
rm -rf $(OVVP)*.vvp *.vcd $(LOG_TXT)*_log.txt $(SYN)*syn.v $(DIAGRAMS_GENERATED)*.dot $(DIAGRAMS_GENERATED)*.ps