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

Subversion Repositories plb2wbbridge

[/] [plb2wbbridge/] [trunk/] [coregen/] [fifo_generator/] [fifo_generator.rb] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 feddischso
#!/usr/bin/ruby
2
 
3
# Usage: ruby fifo_generator [OPTIONS]... setup-file
4
#
5
#  OPTIONS:
6
#
7
#     -c --no-coregen         do not run coregen (Only creates *.xco command_files)
8
#     -v --cp-vhdl-to-lib     copy vhdl-files to library folder
9
#                             (path is set in 'setup-file')
10
#     -n --cp-ngc-to_imp      copy netlist-files to implementation folder
11
#                             (path is set in 'setup_file')
12
#     -? --help               display this message
13
#
14
require 'pp'
15
require 'getoptlong'
16
require 'rdoc/usage'
17
#=======================================================================
18
#
19
#    _____ _  __              ____                           _
20
#   |  ___(_)/ _| ___        / ___| ___ _ __   ___ _ __ __ _| |_ ___  _ __
21
#   | |_  | | |_ / _ \ _____| |  _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__|
22
#   |  _| | |  _| (_) |_____| |_| |  __/ | | |  __/ | | (_| | || (_) | |
23
#   |_|   |_|_|  \___/       \____|\___|_| |_|\___|_|  \__,_|\__\___/|_|
24
#   _______________________________________________
25
#                          _________________________________________________________
26
#
27
#
28
#
29
#
30
#
31
#
32
#
33
#
34
#=======================================================================
35
#
36
#
37
#  Global constants/strings
38
#
39
#=======================================================================
40
 
41
BASE_INFO="
42
######################
43
#
44
#   Auto generated by 'fifo_generator.rb'.
45
#   Please modify only 'plb2wb_bridge.setup',
46
#   modifications to this file will be overwritten!
47
#
48
####
49
"
50
BASE_SELECT="
51
SELECT Fifo_Generator family Xilinx,_Inc. 5.3
52
"
53
# CSET use_extra_logic=false  ??
54
#=======================================================================
55
#
56
#
57
#  Global variables
58
#
59
#=======================================================================
60
$plb2wb_bridge_vhdl_dir    = nil
61
$plb2wb_bridge_ngc_dir     = nil
62
$address_buffer_size       = nil
63
$read_buffer_size          = nil
64
$write_buffer_size         = nil
65
$device                    = nil
66
$device_family             = nil
67
$package                   = nil
68
$speedgrade                = nil
69
$address_buffer_mindwidth  = nil
70
$read_buffer_dwidth        = nil
71
$write_buffer_dwidth       = nil
72
$wb_clk_frequency          = nil
73
$plb_clk_frequency         = nil
74
$mid2plb_buffer_size       = nil
75
$stat2plb_buffer_size      = nil
76
$stat2plb_buffer_mindwidth = nil
77
$stat2wb_buffer_size       = nil
78
$stat2wb_buffer_dwidth     = nil
79
$opt_no_coregen            = false
80
$opt_cp_vhdl               = false
81
$opt_cp_ngc                = false
82
 
83
#=======================================================================
84
#
85
#
86
# functions to set and check gloval variables
87
#
88
#=======================================================================
89
def all_items_set?
90
 
91
   all_items_set = true;
92
 
93
   if $address_buffer_size == nil
94
      all_items_set = false;
95
      print "'Address_Buffer_Size' is not set in setup file\n"
96
   end
97
   if $read_buffer_size == nil
98
      all_items_set = false;
99
      print "'Read_Buffer_Size' is not set in setup file\n"
100
   end
101
   if $write_buffer_size == nil
102
      all_items_set = false;
103
      print "'Write_Buffer_Size' is not set in setup file\n"
104
   end
105
   if $device == nil
106
      all_items_set = false;
107
      print "'Device' is not set in setup file\n"
108
   end
109
   if $device_family  == nil
110
      all_items_set = false;
111
      print "'Device_Family' is not set in setup file\n"
112
   end
113
   if $package == nil
114
      all_items_set = false;
115
      print "'Package' is not set in setup file\n"
116
   end
117
   if $speedgrade == nil
118
      all_items_set = false;
119
      print "'Speedgrade' is not set in setup file\n"
120
   end
121
   if $address_buffer_mindwidth == nil
122
      all_items_set = false;
123
      print "'Address_Buffer_minDWidth' is not set in setup file\n"
124
   end
125
   if $read_buffer_dwidth == nil
126
      all_items_set = false;
127
      print "'Read_Buffer_DWidth' is not set in setup file\n"
128
   end
129
   if $write_buffer_dwidth == nil
130
      all_items_set = false;
131
      print "'Write_Buffer_DWidth' is not set in setup file\n"
132
   end
133
   if $wb_clk_frequency == nil
134
      all_items_set = false;
135
      print "'PLB_Clk_Frequency' is not set in setup file\n"
136
   end
137
   if $plb_clk_frequency == nil
138
      all_items_set = false;
139
      print "'WB_Clk_Frequency' is not set in setup file\n"
140
   end
141
   if $stat2plb_buffer_size == nil
142
      all_items_set = false;
143
      print "'Stat2PLB_Buffer_Size' is not set in setup file\n"
144
   end
145
   if $stat2plb_buffer_mindwidth == nil
146
      all_items_set = false;
147
      print "'Stat2PLB_Buffer_minDWidth' is not set in setup file\n"
148
   end
149
   if $stat2wb_buffer_size == nil
150
      all_items_set = false;
151
      print "'Stat2WB_Buffer_Size' is not set in setup file\n"
152
   end
153
   if $stat2wb_buffer_dwidth == nil
154
      all_items_set = false;
155
      print "'Stat2WB_Buffer_DWidth' is not set in setup file\n"
156
   end
157
   return all_items_set
158
end
159
 
160
 
161
def set_item( item, value )
162
 
163
 
164
   case item
165
      when "PLB2WB_Bridge_VHDL_DIR"
166
         $plb2wb_bridge_vhdl_dir = value
167
      when "Address_Buffer_Size"
168
         if value =~ /^[0-9]*$/
169
            $address_buffer_size = value
170
         else
171
            print "Invalid format for `Address_Buffer_Size` in setup file\n";exit
172
         end
173
      when "Read_Buffer_Size"
174
         if value =~ /^[0-9]*$/
175
            $read_buffer_size = value
176
         else
177
            print "Invalid format for `Read_Buffer_Size` in setup file\n";exit
178
         end
179
      when "Write_Buffer_Size"
180
         if value =~ /^[0-9]*$/
181
            $write_buffer_size = value
182
         else
183
            print "Invalid format for `Write_Buffer_Size` in setup file\n";exit
184
         end
185
      when "Device_Family"
186
         $device_family = value
187
      when "Device"
188
         $device = value
189
      when "Package"
190
         $package = value
191
      when "Speedgrade"
192
         if value =~ /^\-[0-9]*$/
193
            $speedgrade = value
194
         end
195
      when "Address_Buffer_minDWidth"
196
         if value =~ /^[0-9]*$/
197
            $address_buffer_mindwidth = value
198
         else
199
            print "Invalid format for `Address_Buffer_minDWidth` in setup file\n";exit
200
         end
201
      when "Read_Buffer_DWidth"
202
         if value =~ /^[0-9]*$/
203
            $read_buffer_dwidth = value
204
         else
205
            print "Invalid format for `Read_Buffer_DWidth` in setup file\n";exit
206
         end
207
      when "Write_Buffer_DWidth"
208
         if value =~ /^[0-9]*$/
209
            $write_buffer_dwidth = value
210
         else
211
            print "Invalid format for `Write_Buffer_DWidth` in setup file\n";exit
212
         end
213
      when "WB_Clk_Frequency"
214
         if value =~ /^[0-9]*$/
215
            $wb_clk_frequency = value
216
         else
217
            print "Invalid format for `WB_Clk_Frequency` in setup file\n";exit
218
         end
219
      when "PLB_Clk_Frequency"
220
         if value =~ /^[0-9]*$/
221
            $plb_clk_frequency = value
222
         else
223
            print "Invalid format for `PLB_Clk_Frequency` in setup file\n";exit
224
         end
225
      when "PLB2WB_Bridge_NGC_DIR"
226
         $plb2wb_bridge_ngc_dir = value
227
 
228
      when "Stat2PLB_Buffer_Size"
229
         if value =~ /^[0-9]*$/
230
            $stat2plb_buffer_size = value
231
         else
232
            print "Invalid format for `Stat2PLB_Buffer_Size` in setup file\n";exit
233
         end
234
 
235
      when "Stat2PLB_Buffer_minDWidth"
236
         if value =~ /^[0-9]*$/
237
            $stat2plb_buffer_mindwidth = value
238
         else
239
            print "Invalid format for `Stat2PLB_Buffer_minDWidth` in setup file\n";exit
240
         end
241
 
242
      when "Stat2WB_Buffer_Size"
243
         if value =~ /^[0-9]*$/
244
            $stat2wb_buffer_size = value
245
         else
246
            print "Invalid format for `Stat2WB_Buffer_Size` in setup file\n";exit
247
         end
248
 
249
      when "Stat2WB_Buffer_DWidth"
250
         if value =~ /^[0-9]*$/
251
            $stat2wb_buffer_dwidth = value
252
         else
253
            print "Invalid format for `Stat2WB_Buffer_DWidth` in setup file\n";exit
254
         end
255
 
256
      end
257
 
258
end
259
#=======================================================================
260
#
261
#
262
# *.XCO-File generation helpers
263
#
264
#=======================================================================
265
def print_project_header( file )
266
 
267
   file.puts( "SET addpads = False"                   )
268
   file.puts( "SET asysymbol = True"                  )
269
   file.puts( "SET busformat = BusFormatParenNotRipped")
270
   file.puts( "SET createndf = False"                 )
271
   file.puts( "SET designentry = VHDL"                )
272
   file.puts( "SET device = "       + $device         )
273
   file.puts( "SET devicefamily = " + $device_family  )
274
   file.puts( "SET flowvendor = Other"                )
275
   file.puts( "SET formalverification = False"        )
276
   file.puts( "SET foundationsym = False"             )
277
   file.puts( "SET implementationfiletype = Ngc"      )
278
   file.puts( "SET package = "      + $package        )
279
   file.puts( "SET removerpms = False"                )
280
   file.puts( "SET simulationfiles = Structural"      )
281
   file.puts( "SET speedgrade = "   + $speedgrade     )
282
   file.puts( "SET verilogsim = False"                )
283
   file.puts( "SET vhdlsim = True"                    )
284
 
285
 
286
 
287
 
288
end
289
 
290
 
291
def print_fifo_parameters( file, independet_clocks, component_name, deepth, width, r_clk_frq, w_clk_frq, with_almost_empty )
292
 
293
   data_count_width = Math.log( deepth ) / Math.log( 2 )
294
 
295
   if with_almost_empty
296
      file.puts( "CSET almost_empty_flag=true"                 )
297
   else
298
      file.puts( "CSET almost_empty_flag=false"                )
299
   end
300
   file.puts( "CSET almost_full_flag=false"                    )
301
   file.puts( "CSET component_name=#{component_name}"          )
302
   file.puts( "CSET data_count=false"                          )
303
   file.puts( "CSET data_count_width=#{data_count_width.to_i}" )
304
   file.puts( "CSET disable_timing_violations=false"           )
305
   file.puts( "CSET dout_reset_value=0"                        )
306
   file.puts( "CSET empty_threshold_assert_value=1"            )
307
   file.puts( "CSET empty_threshold_negate_value=1"            )
308
   file.puts( "CSET enable_ecc=false"                          )
309
   file.puts( "CSET enable_int_clk=false"                      )
310
   file.puts( "CSET enable_reset_synchronization=true"         )
311
   if independet_clocks == false
312
   #common clocks
313
      if deepth.to_i < 512
314
         file.puts( "CSET fifo_implementation=Common_Clock_Distributed_RAM" )
315
      else
316
         if with_almost_empty
317
            file.puts( "CSET fifo_implementation=Common_Clock_Block_RAM" )
318
         else
319
            file.puts( "CSET fifo_implementation=Common_Clock_Builtin_FIFO" )
320
         end
321
      end
322
   else
323
   #independet clocks
324
      if deepth.to_i < 512
325
         file.puts( "CSET fifo_implementation=Independent_Clocks_Distributed_RAM" )
326
      else
327
         if with_almost_empty
328
            file.puts( "CSET fifo_implementation=Independent_Clocks_Block_RAM" )
329
         else
330
            file.puts( "CSET fifo_implementation=Independent_Clocks_Builtin_FIFO" )
331
         end
332
      end
333
   end
334
   file.puts( "CSET full_flags_reset_value=0"                  )
335
   file.puts( "CSET full_threshold_assert_value=1"             )
336
   file.puts( "CSET full_threshold_negate_value=1"             )
337
   file.puts( "CSET inject_dbit_error=false"                   )
338
   file.puts( "CSET inject_sbit_error=false"                   )
339
   file.puts( "CSET input_data_width=#{width}"                 )
340
   file.puts( "CSET input_depth=#{deepth}"                     )
341
   file.puts( "CSET output_data_width=#{width}"                )
342
   file.puts( "CSET output_depth=#{deepth}"                    )
343
   file.puts( "CSET overflow_flag=false"                       )
344
   file.puts( "CSET overflow_sense=Active_High"                )
345
   file.puts( "CSET performance_options=First_Word_Fall_Through"              )
346
   file.puts( "CSET programmable_empty_type=No_Programmable_Empty_Threshold"  )
347
   file.puts( "CSET programmable_full_type=No_Programmable_Full_Threshold"    )
348
   if deepth.to_i < 512 or independet_clocks == false
349
      file.puts( "CSET read_clock_frequency=1"               )
350
   else
351
      file.puts( "CSET read_clock_frequency=#{r_clk_frq}"               )
352
   end
353
   file.puts( "CSET read_data_count=false"                           )
354
   file.puts( "CSET read_data_count_width=#{data_count_width.to_i}"  )
355
   file.puts( "CSET reset_pin=true"                                  )
356
   file.puts( "CSET reset_type=Asynchronous_Reset"                   )
357
   file.puts( "CSET underflow_flag=false"                            )
358
   file.puts( "CSET underflow_sense=Active_High"                     )
359
   file.puts( "CSET use_dout_reset=false"                            )
360
   file.puts( "CSET use_embedded_registers=false"                    )
361
   file.puts( "CSET valid_flag=false"                                )
362
   file.puts( "CSET valid_sense=Active_High"                         )
363
   file.puts( "CSET write_acknowledge_flag=false"                    )
364
   file.puts( "CSET write_acknowledge_sense=Active_High"             )
365
   if deepth.to_i < 512 or independet_clocks == false
366
      file.puts( "CSET write_clock_frequency=1" )
367
   else
368
      file.puts( "CSET write_clock_frequency=#{w_clk_frq}" )
369
   end
370
   file.puts( "CSET write_data_count=false"                          )
371
   file.puts( "CSET write_data_count_width=#{data_count_width.to_i}" )
372
 
373
 
374
end
375
#======================================================================
376
#
377
#     XCO-File generation and syntehsis functions
378
#
379
#
380
#======================================================================
381
 
382
 
383
 
384
def generate_adr_fifos( independet_clocks )
385
 
386
   cc_or_ic = (independet_clocks == true)? "ic" : "cc"
387
 
388
   open( "fifo_adr_#{cc_or_ic}_1.xco", "w" ) do |file|
389
      file.puts( BASE_INFO )
390
      print_project_header( file )
391
      file.puts( BASE_SELECT )
392
      print_fifo_parameters(  file,
393
                              independet_clocks,
394
                              "fifo_adr_#{cc_or_ic}_1",
395
                              $address_buffer_size,
396
                              $address_buffer_mindwidth.to_i,
397
                              $wb_clk_frequency,
398
                              $plb_clk_frequency,
399
                              false )
400
      file.puts( "GENERATE" )
401
      file.close
402
   end
403
 
404
 
405
 
406
   open( "fifo_adr_#{cc_or_ic}_2.xco", "w" ) do |file|
407
      file.puts( BASE_INFO )
408
      print_project_header( file )
409
      file.puts( BASE_SELECT )
410
      print_fifo_parameters(  file,
411
                              independet_clocks,
412
                              "fifo_adr_#{cc_or_ic}_2",
413
                              $address_buffer_size,
414
                              $address_buffer_mindwidth.to_i + 1,
415
                              $wb_clk_frequency,
416
                              $plb_clk_frequency,
417
                              false )
418
      file.puts( "GENERATE" )
419
      file.close
420
   end
421
 
422
 
423
 
424
 
425
   open( "fifo_adr_#{cc_or_ic}_3.xco", "w" ) do |file|
426
      file.puts( BASE_INFO )
427
      print_project_header( file )
428
      file.puts( BASE_SELECT )
429
      print_fifo_parameters(  file,
430
                              independet_clocks,
431
                              "fifo_adr_#{cc_or_ic}_3",
432
                              $address_buffer_size,
433
                              $address_buffer_mindwidth.to_i + 2,
434
                              $wb_clk_frequency,
435
                              $plb_clk_frequency,
436
                              false )
437
      file.puts( "GENERATE" )
438
      file.close
439
   end
440
 
441
 
442
 
443
 
444
   open( "fifo_adr_#{cc_or_ic}_4.xco", "w" ) do |file|
445
      file.puts( BASE_INFO )
446
      print_project_header( file )
447
      file.puts( BASE_SELECT )
448
      print_fifo_parameters(  file,
449
                              independet_clocks,
450
                              "fifo_adr_#{cc_or_ic}_4",
451
                              $address_buffer_size,
452
                              $address_buffer_mindwidth.to_i + 3,
453
                              $wb_clk_frequency,
454
                              $plb_clk_frequency,
455
                              false )
456
      file.puts( "GENERATE" )
457
      file.close
458
   end
459
 
460
 
461
   system( "coregen -b fifo_adr_#{cc_or_ic}_1.xco" ) if $opt_no_coregen == false
462
   system( "coregen -b fifo_adr_#{cc_or_ic}_2.xco" ) if $opt_no_coregen == false
463
   system( "coregen -b fifo_adr_#{cc_or_ic}_3.xco" ) if $opt_no_coregen == false
464
   system( "coregen -b fifo_adr_#{cc_or_ic}_4.xco" ) if $opt_no_coregen == false
465
 
466
end
467
 
468
 
469
def generate_wdat_fifos( independet_clocks )
470
 
471
 
472
   cc_or_ic = (independet_clocks == true)? "ic" : "cc"
473
 
474
   open( "fifo_wdat_#{cc_or_ic}_32.xco", "w" ) do |file|
475
      file.puts( BASE_INFO )
476
      print_project_header( file )
477
      file.puts( BASE_SELECT )
478
      print_fifo_parameters(  file,
479
                              independet_clocks,
480
                              "fifo_wdat_#{cc_or_ic}_32",
481
                              $write_buffer_size,
482
                              $write_buffer_dwidth.to_i,
483
                              $wb_clk_frequency,
484
                              $plb_clk_frequency,
485
                              false )
486
      file.puts( "GENERATE" )
487
      file.close
488
   end
489
 
490
   system( "coregen -b fifo_wdat_#{cc_or_ic}_32.xco" ) if $opt_no_coregen == false
491
 
492
end
493
 
494
 
495
def generate_rdat_fifos( independet_clocks )
496
 
497
 
498
   cc_or_ic = (independet_clocks == true)? "ic" : "cc"
499
 
500
   open( "fifo_rdat_#{cc_or_ic}_32.xco", "w" ) do |file|
501
      file.puts( BASE_INFO )
502
      print_project_header( file )
503
      file.puts( BASE_SELECT )
504
      print_fifo_parameters(  file,
505
                              independet_clocks,
506
                              "fifo_rdat_#{cc_or_ic}_32",
507
                              $read_buffer_size,
508
                              $read_buffer_dwidth.to_i,
509
                              $plb_clk_frequency,
510
                              $wb_clk_frequency,
511
                              true )
512
      file.puts( "GENERATE" )
513
      file.close
514
   end
515
 
516
   system( "coregen -b fifo_rdat_#{cc_or_ic}_32.xco" ) if $opt_no_coregen == false
517
 
518
end
519
 
520
 
521
def  generate_stat2plb_fifos( independet_clocks  )
522
 
523
   cc_or_ic = (independet_clocks == true)? "ic" : "cc"
524
 
525
 
526
 
527
   open( "fifo_stat2plb_#{cc_or_ic}_1.xco", "w" ) do |file|
528
      file.puts( BASE_INFO )
529
      print_project_header( file )
530
      file.puts( BASE_SELECT )
531
      print_fifo_parameters(  file,
532
                              independet_clocks,
533
                              "fifo_stat2plb_#{cc_or_ic}_1",
534
                              $stat2plb_buffer_size,
535
                              $stat2plb_buffer_mindwidth.to_i,
536
                              $plb_clk_frequency,
537
                              $wb_clk_frequency,
538
                              false )
539
      file.puts( "GENERATE" )
540
      file.close
541
   end
542
 
543
 
544
 
545
   open( "fifo_stat2plb_#{cc_or_ic}_2.xco", "w" ) do |file|
546
      file.puts( BASE_INFO )
547
      print_project_header( file )
548
      file.puts( BASE_SELECT )
549
      print_fifo_parameters(  file,
550
                              independet_clocks,
551
                              "fifo_stat2plb_#{cc_or_ic}_2",
552
                              $stat2plb_buffer_size,
553
                              $stat2plb_buffer_mindwidth.to_i + 1,
554
                              $plb_clk_frequency,
555
                              $wb_clk_frequency,
556
                              false )
557
      file.puts( "GENERATE" )
558
      file.close
559
   end
560
 
561
 
562
 
563
   open( "fifo_stat2plb_#{cc_or_ic}_3.xco", "w" ) do |file|
564
      file.puts( BASE_INFO )
565
      print_project_header( file )
566
      file.puts( BASE_SELECT )
567
      print_fifo_parameters(  file,
568
                              independet_clocks,
569
                              "fifo_stat2plb_#{cc_or_ic}_3",
570
                              $stat2plb_buffer_size,
571
                              $stat2plb_buffer_mindwidth.to_i + 2,
572
                              $plb_clk_frequency,
573
                              $wb_clk_frequency,
574
                              false )
575
      file.puts( "GENERATE" )
576
      file.close
577
   end
578
 
579
 
580
 
581
   open( "fifo_stat2plb_#{cc_or_ic}_4.xco", "w" ) do |file|
582
      file.puts( BASE_INFO )
583
      print_project_header( file )
584
      file.puts( BASE_SELECT )
585
      print_fifo_parameters(  file,
586
                              independet_clocks,
587
                              "fifo_stat2plb_#{cc_or_ic}_4",
588
                              $stat2plb_buffer_size,
589
                              $stat2plb_buffer_mindwidth.to_i + 3,
590
                              $plb_clk_frequency,
591
                              $wb_clk_frequency,
592
                              false )
593
      file.puts( "GENERATE" )
594
      file.close
595
   end
596
 
597
   system( "coregen -b fifo_stat2plb_#{cc_or_ic}_1.xco" ) if $opt_no_coregen == false
598
   system( "coregen -b fifo_stat2plb_#{cc_or_ic}_2.xco" ) if $opt_no_coregen == false
599
   system( "coregen -b fifo_stat2plb_#{cc_or_ic}_3.xco" ) if $opt_no_coregen == false
600
   system( "coregen -b fifo_stat2plb_#{cc_or_ic}_4.xco" ) if $opt_no_coregen == false
601
 
602
end
603
 
604
def  generate_stat2wb_fifos( independet_clocks  )
605
 
606
   cc_or_ic = (independet_clocks == true)? "ic" : "cc"
607
 
608
   open( "fifo_stat2wb_#{cc_or_ic}.xco", "w" ) do |file|
609
      file.puts( BASE_INFO )
610
      print_project_header( file )
611
      file.puts( BASE_SELECT )
612
      print_fifo_parameters(  file,
613
                              independet_clocks,
614
                              "fifo_stat2wb_#{cc_or_ic}",
615
                              $stat2wb_buffer_size,
616
                              $stat2wb_buffer_dwidth.to_i,
617
                              $plb_clk_frequency,
618
                              $wb_clk_frequency,
619
                              false )
620
      file.puts( "GENERATE" )
621
      file.close
622
   end
623
 
624
   system( "coregen -b fifo_stat2wb_#{cc_or_ic}.xco" ) if $opt_no_coregen == false
625
 
626
end
627
 
628
 
629
 
630
#=================================================================
631
#
632
#     Main-script starts here:
633
#
634
#=================================================================
635
opts= GetoptLong.new(
636
   ['--no-coregen',     '-c', GetoptLong::NO_ARGUMENT],
637
   ['--cp-vhdl-to-lib', '-v', GetoptLong::NO_ARGUMENT],
638
   ['--cp-ngc-to-imp',  '-n', GetoptLong::NO_ARGUMENT],
639
   ['--help',           '-?', GetoptLong::NO_ARGUMENT]
640
   )
641
 
642
 
643
opts.each do |opt, arg|
644
   case opt
645
      when '--no-coregen'
646
         $opt_no_coregen   = true
647
      when '--cp-vhdl-to-lib'
648
         $opt_cp_vhdl      = true
649
      when '--cp-ngc-to-imp'
650
         $opt_cp_ngc       = true
651
      when '--help'
652
         RDoc::usage
653
   end
654
end
655
 
656
if ARGV.length != 1
657
   RDoc::usage
658
end
659
 
660
 
661
 
662
if File.exists? ARGV[0]
663
 
664
 
665
   open( 'plb2wb_bridge.setup' ) do |file|
666
      file.each { |line|
667
 
668
         # check, if this is a valid setup-line
669
         if line =~ /[\s]*([a-zA-Z0-9_]+)[\s]*=[\s]*([\-0-9a-zA-Z\.\/_]+)/
670
            set_item( $1, $2 )
671
         end
672
      }
673
   end
674
else
675
   print "#{ARGV[0]} not found!\n\n"
676
   RDoc::usage
677
end
678
 
679
 
680
 
681
 
682
if all_items_set?
683
 
684
   generate_stat2plb_fifos  ( true  )
685
   generate_stat2plb_fifos  ( false )
686
   generate_adr_fifos      ( true  )
687
   generate_adr_fifos      ( false )
688
   generate_wdat_fifos     ( true  )
689
   generate_wdat_fifos     ( false )
690
   generate_rdat_fifos     ( true  )
691
   generate_rdat_fifos     ( false )
692
   generate_stat2wb_fifos ( true  )
693
   generate_stat2wb_fifos ( false )
694
 
695
 
696
 
697
   if $opt_cp_vhdl
698
      if $plb2wb_bridge_vhdl_dir == nil
699
         print "'PLB2WB_Bridge_VHDL_Dir' is not set in plb2wb_bridge.setup\n"
700
      else
701
         system( "cp *.vhd #{$plb2wb_bridge_vhdl_dir }" )
702
         print "Copy vhdl-files to '#{$plb2wb_bridge_vhdl_dir}'\n"
703
      end
704
   end
705
 
706
   if $opt_cp_ngc
707
      if $plb2wb_bridge_ngc_dir == nil
708
         print "'PLB2WB_Bridge_NGC_Dir' is not set in plb2wb_bridge.setup\n"
709
      else
710
         print "Copy netlists to '#{$plb2wb_bridge_ngc_dir}'\n"
711
         system( "cp *.ngc #{$plb2wb_bridge_ngc_dir }" )
712
      end
713
   end
714
 
715
else
716
   print "Please complete 'plb2wb_bridge.setup'\n"
717
   exit
718
end
719
 
720
 
721
 
722
 
723
#=================================================================

powered by: WebSVN 2.1.0

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