OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_c/] [jtag/] [test_rtl/] [jtag_ram_test/] [src_verilog/] [lib/] [arbiter.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 alirezamon
 `timescale     1ns/1ps
2
/**********************************************************************
3
**      File: arbiter.v
4
**
5
**      Copyright (C) 2014-2017  Alireza Monemi
6
**
7
**      This file is part of ProNoC
8
**
9
**      ProNoC ( stands for Prototype Network-on-chip)  is free software:
10
**      you can redistribute it and/or modify it under the terms of the GNU
11
**      Lesser General Public License as published by the Free Software Foundation,
12
**      either version 2 of the License, or (at your option) any later version.
13
**
14
**      ProNoC is distributed in the hope that it will be useful, but WITHOUT
15
**      ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16
**      or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
17
**      Public License for more details.
18
**
19
**      You should have received a copy of the GNU Lesser General Public
20
**      License along with ProNoC. If not, see <http:**www.gnu.org/licenses/>.
21
**
22
**
23
**
24
**      Description:
25
**      This file contains several Fixed prority and round robin
26
**      arbiters
27
**
28
******************************************************************************/
29
 
30
 
31
/*****************************************
32
*
33
* general round robin arbiter
34
*
35
*
36
******************************************/
37
 
38
module arbiter #(
39
    parameter    ARBITER_WIDTH    =8
40
 
41
)
42
(
43
   clk,
44
   reset,
45
   request,
46
   grant,
47
   any_grant
48
);
49
 
50
 
51
    input    [ARBITER_WIDTH-1             :    0]    request;
52
    output    [ARBITER_WIDTH-1            :    0]    grant;
53
    output                                        any_grant;
54
    input                                        clk;
55
    input                                        reset;
56
 
57
 
58
 
59
    generate
60
    if(ARBITER_WIDTH==1)  begin: w1
61
        assign grant= request;
62
        assign any_grant =request;
63
    end else if(ARBITER_WIDTH<=4) begin: w4
64
        //my own arbiter 
65
        my_one_hot_arbiter #(
66
            .ARBITER_WIDTH    (ARBITER_WIDTH)
67
        )
68
        one_hot_arb
69
        (
70
            .clk            (clk),
71
            .reset         (reset),
72
            .request        (request),
73
            .grant        (grant),
74
            .any_grant    (any_grant)
75
        );
76
 
77
    end else begin : wb4
78
 
79
        thermo_arbiter #(
80
            .ARBITER_WIDTH    (ARBITER_WIDTH)
81
        )
82
        one_hot_arb
83
        (
84
            .clk            (clk),
85
            .reset         (reset),
86
            .request        (request),
87
            .grant        (grant),
88
            .any_grant    (any_grant)
89
        );
90
    end
91
    endgenerate
92
endmodule
93
 
94
/*****************************************
95
*
96
*        arbiter_priority_en
97
* RRA with external priority enable signal
98
*
99
******************************************/
100
 
101
module arbiter_priority_en #(
102
        parameter    ARBITER_WIDTH    =8
103
 
104
)
105
(
106
   clk,
107
   reset,
108
   request,
109
   grant,
110
   any_grant,
111
   priority_en
112
);
113
 
114
 
115
 
116
 
117
    input        [ARBITER_WIDTH-1             :    0]    request;
118
    output    [ARBITER_WIDTH-1            :    0]    grant;
119
    output                                            any_grant;
120
    input                                                clk;
121
    input                                                reset;
122
    input                                              priority_en;
123
 
124
 
125
    generate
126
    if(ARBITER_WIDTH==1)  begin: w1
127
        assign grant= request;
128
        assign any_grant =request;
129
    end else if(ARBITER_WIDTH<=4) begin: w4
130
        //my own arbiter 
131
        my_one_hot_arbiter_priority_en #(
132
            .ARBITER_WIDTH    (ARBITER_WIDTH)
133
        )
134
        one_hot_arb
135
        (
136
            .clk            (clk),
137
            .reset         (reset),
138
            .request        (request),
139
            .grant        (grant),
140
            .any_grant    (any_grant),
141
            .priority_en (priority_en)
142
 
143
        );
144
 
145
    end else begin :wb4
146
 
147
        thermo_arbiter_priority_en #(
148
            .ARBITER_WIDTH    (ARBITER_WIDTH)
149
        )
150
        one_hot_arb
151
        (
152
            .clk            (clk),
153
            .reset         (reset),
154
            .request        (request),
155
            .grant        (grant),
156
            .any_grant    (any_grant),
157
            .priority_en (priority_en)
158
        );
159
    end
160
endgenerate
161
endmodule
162
 
163
 
164
 
165
/******************************************************
166
*       my_one_hot_arbiter
167
* RRA with binary-coded priority register. Binary-coded
168
* Priority results in less area cost and CPD for arbire
169
* width of 4 and smaller only.
170
*
171
******************************************************/
172
 
173
 
174
 
175
module my_one_hot_arbiter #(
176
    parameter ARBITER_WIDTH    =4
177
 
178
 
179
)
180
(
181
    input        [ARBITER_WIDTH-1             :    0]    request,
182
    output    [ARBITER_WIDTH-1            :    0]    grant,
183
    output                                            any_grant,
184
    input                                                clk,
185
    input                                                reset
186
);
187
 
188
    function integer log2;
189
      input integer number; begin
190
         log2=(number <=1) ? 1: 0;
191
         while(2**log2<number) begin
192
            log2=log2+1;
193
         end
194
      end
195
    endfunction // log2 
196
 
197
    localparam ARBITER_BIN_WIDTH= log2(ARBITER_WIDTH);
198
    reg     [ARBITER_BIN_WIDTH-1        :    0]     low_pr;
199
    wire     [ARBITER_BIN_WIDTH-1        :    0]     grant_bcd;
200
 
201
    one_hot_to_bin #(
202
        .ONE_HOT_WIDTH    (ARBITER_WIDTH)
203
    )conv
204
    (
205
    .one_hot_code(grant),
206
    .bin_code(grant_bcd)
207
 
208
    );
209
 
210
 
211 48 alirezamon
`ifdef SYNC_RESET_MODE
212
    always @ (posedge clk )begin
213
`else
214
    always @ (posedge clk or posedge reset)begin
215
`endif
216
 
217 38 alirezamon
        if(reset) begin
218
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
219
        end else begin
220
            if(any_grant) low_pr <= grant_bcd;
221
        end
222
    end
223
 
224
 
225
    assign any_grant = | request;
226
 
227
    generate
228
        if(ARBITER_WIDTH    ==2) begin: w2        arbiter_2_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
229
        if(ARBITER_WIDTH    ==3) begin: w3        arbiter_3_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
230
        if(ARBITER_WIDTH    ==4) begin: w4        arbiter_4_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
231
    endgenerate
232
 
233
endmodule
234
 
235
 
236
module arbiter_2_one_hot(
237
     input      [1             :    0]    in,
238
     output    reg[1                :    0]    out,
239
     input                                low_pr
240
);
241
always @(*) begin
242
     out=2'b00;
243
      case(low_pr)
244
         1'd0:
245
             if(in[1])                 out=2'b10;
246
             else if(in[0])         out=2'b01;
247
         1'd1:
248
             if(in[0])                 out=2'b01;
249
             else if(in[1])         out=2'b10;
250
          default: out=2'b00;
251
     endcase
252
  end
253
 endmodule
254
 
255
 
256
 
257
 
258
module arbiter_3_one_hot(
259
     input      [2             :    0]    in,
260
     output    reg[2                :    0]    out,
261
     input        [1                :    0]    low_pr
262
);
263
always @(*) begin
264
  out=3'b000;
265
      case(low_pr)
266
         2'd0:
267
             if(in[1])                 out=3'b010;
268
             else if(in[2])         out=3'b100;
269
             else if(in[0])         out=3'b001;
270
         2'd1:
271
             if(in[2])                 out=3'b100;
272
             else if(in[0])         out=3'b001;
273
             else if(in[1])         out=3'b010;
274
         2'd2:
275
             if(in[0])                 out=3'b001;
276
             else if(in[1])         out=3'b010;
277
             else if(in[2])         out=3'b100;
278
         default: out=3'b000;
279
     endcase
280
  end
281
 endmodule
282
 
283
 
284
 module arbiter_4_one_hot(
285
     input      [3             :    0]    in,
286
     output    reg[3                :    0]    out,
287
     input        [1                :    0]    low_pr
288
);
289
always @(*) begin
290
  out=4'b0000;
291
      case(low_pr)
292
         2'd0:
293
             if(in[1])                 out=4'b0010;
294
             else if(in[2])         out=4'b0100;
295
             else if(in[3])         out=4'b1000;
296
             else if(in[0])         out=4'b0001;
297
         2'd1:
298
             if(in[2])                 out=4'b0100;
299
             else if(in[3])         out=4'b1000;
300
             else if(in[0])         out=4'b0001;
301
             else if(in[1])         out=4'b0010;
302
         2'd2:
303
             if(in[3])                 out=4'b1000;
304
             else if(in[0])         out=4'b0001;
305
             else if(in[1])         out=4'b0010;
306
             else if(in[2])         out=4'b0100;
307
         2'd3:
308
             if(in[0])                 out=4'b0001;
309
             else if(in[1])         out=4'b0010;
310
             else if(in[2])         out=4'b0100;
311
             else if(in[3])         out=4'b1000;
312
         default: out=4'b0000;
313
     endcase
314
  end
315
 endmodule
316
 
317
 
318
/******************************************************
319
*       my_one_hot_arbiter_priority_en
320
*
321
******************************************************/
322
 
323
 
324
 
325
module my_one_hot_arbiter_priority_en #(
326
    parameter ARBITER_WIDTH    =4
327
 
328
 
329
)
330
(
331
    input        [ARBITER_WIDTH-1             :    0]    request,
332
    output    [ARBITER_WIDTH-1            :    0]    grant,
333
    output                                            any_grant,
334
    input                                                clk,
335
    input                                                reset,
336
    input                                                priority_en
337
);
338
 
339
    function integer log2;
340
      input integer number; begin
341
         log2=(number <=1) ? 1: 0;
342
         while(2**log2<number) begin
343
            log2=log2+1;
344
         end
345
      end
346
    endfunction // log2 
347
 
348
    localparam ARBITER_BIN_WIDTH= log2(ARBITER_WIDTH);
349
    reg     [ARBITER_BIN_WIDTH-1        :    0]     low_pr;
350
    wire     [ARBITER_BIN_WIDTH-1        :    0]     grant_bcd;
351
 
352
    one_hot_to_bin #(
353
        .ONE_HOT_WIDTH    (ARBITER_WIDTH)
354
    )conv
355
    (
356
        .one_hot_code(grant),
357
        .bin_code(grant_bcd)
358
    );
359 48 alirezamon
 
360
`ifdef SYNC_RESET_MODE
361
    always @ (posedge clk )begin
362
`else
363
    always @ (posedge clk or posedge reset)begin
364
`endif
365
 
366 38 alirezamon
        if(reset) begin
367
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
368
        end else begin
369
            if(priority_en) low_pr <= grant_bcd;
370
        end
371
    end
372
 
373
 
374
    assign any_grant = | request;
375
 
376
    generate
377
        if(ARBITER_WIDTH    ==2) begin :w2        arbiter_2_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
378
        if(ARBITER_WIDTH    ==3) begin :w3        arbiter_3_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
379
        if(ARBITER_WIDTH    ==4) begin :w4        arbiter_4_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
380
    endgenerate
381
 
382
endmodule
383
 
384
 
385
 
386
/*******************
387
*
388
*    thermo_arbiter RRA
389
*
390
********************/
391
 
392
module thermo_gen #(
393
    parameter WIDTH=16
394
 
395
 
396
)(
397
    input  [WIDTH-1    :    0]in,
398
    output [WIDTH-1    :    0]out
399
);
400
    genvar i;
401
    generate
402
    for(i=0;i<WIDTH;i=i+1)begin :lp
403
        assign out[i]= | in[i    :0];
404
    end
405
    endgenerate
406
 
407
endmodule
408
 
409
 
410
 
411
 
412
module thermo_arbiter #(
413
 parameter    ARBITER_WIDTH    =4
414
 
415
)
416
(
417
   clk,
418
   reset,
419
   request,
420
   grant,
421
   any_grant
422
);
423
 
424
 
425
 
426
 
427
    input        [ARBITER_WIDTH-1             :    0]    request;
428
    output    [ARBITER_WIDTH-1            :    0]    grant;
429
    output                                            any_grant;
430
    input                                                reset,clk;
431
 
432
 
433
    wire        [ARBITER_WIDTH-1             :    0]    termo1,termo2,mux_out,masked_request,edge_mask;
434
    reg        [ARBITER_WIDTH-1             :    0]    pr;
435
 
436
 
437
    thermo_gen #(
438
        .WIDTH(ARBITER_WIDTH)
439
    ) tm1
440
    (
441
        .in(request),
442
        .out(termo1)
443
    );
444
 
445
 
446
 
447
 
448
    thermo_gen #(
449
        .WIDTH(ARBITER_WIDTH)
450
    ) tm2
451
    (
452
        .in(masked_request),
453
        .out(termo2)
454
    );
455
 
456
 
457 48 alirezamon
    assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
458
    assign masked_request= request & pr;
459
    assign any_grant=termo1[ARBITER_WIDTH-1];
460 38 alirezamon
 
461 48 alirezamon
`ifdef SYNC_RESET_MODE
462
    always @ (posedge clk )begin
463
`else
464
    always @ (posedge clk or posedge reset)begin
465
`endif
466
        if(reset) pr<= {ARBITER_WIDTH{1'b1}};
467
        else begin
468
            if(any_grant) pr<= edge_mask;
469
        end
470 38 alirezamon
    end
471
 
472 48 alirezamon
    assign edge_mask= {mux_out[ARBITER_WIDTH-2:0],1'b0};
473
    assign grant= mux_out ^ edge_mask;
474 38 alirezamon
 
475
 
476
 
477
endmodule
478
 
479
 
480
 
481
 
482
 
483
module thermo_arbiter_priority_en #(
484
 parameter    ARBITER_WIDTH    =4
485
 
486
)
487
(
488
   clk,
489
   reset,
490
   request,
491
   grant,
492
   any_grant,
493
   priority_en
494
);
495
 
496
 
497
 
498
 
499
    input        [ARBITER_WIDTH-1             :    0]    request;
500
    output    [ARBITER_WIDTH-1            :    0]    grant;
501
    output                                            any_grant;
502
    input                                                reset,clk;
503
    input priority_en;
504
 
505
    wire        [ARBITER_WIDTH-1             :    0]    termo1,termo2,mux_out,masked_request,edge_mask;
506
    reg        [ARBITER_WIDTH-1             :    0]    pr;
507
 
508
 
509
    thermo_gen #(
510
        .WIDTH(ARBITER_WIDTH)
511
    ) tm1
512
    (
513
        .in(request),
514
        .out(termo1)
515
    );
516
 
517
 
518
 
519
 
520
    thermo_gen #(
521
        .WIDTH(ARBITER_WIDTH)
522
    ) tm2
523
    (
524
        .in(masked_request),
525
        .out(termo2)
526
    );
527
 
528
 
529
assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
530
assign masked_request= request & pr;
531
assign any_grant=termo1[ARBITER_WIDTH-1];
532
 
533 48 alirezamon
`ifdef SYNC_RESET_MODE
534
    always @ (posedge clk )begin
535
`else
536
    always @ (posedge clk or posedge reset)begin
537
`endif
538
 
539
 
540 38 alirezamon
    if(reset) pr<= {ARBITER_WIDTH{1'b1}};
541
    else begin
542
        if(priority_en) pr<= edge_mask;
543
    end
544
 
545
end
546
 
547
assign edge_mask= {mux_out[ARBITER_WIDTH-2:0],1'b0};
548
assign grant= mux_out ^ edge_mask;
549
 
550
 
551
 
552
endmodule
553
 
554
 
555
 
556
 
557
 
558
 
559
 
560
 
561
module thermo_arbiter_ext_priority #(
562
 parameter    ARBITER_WIDTH    =4
563
 
564
)
565
(
566
 
567
   request,
568
   grant,
569
   any_grant,
570
   priority_in
571
 
572
);
573
 
574
 
575
 
576
 
577
    input        [ARBITER_WIDTH-1             :    0]    request;
578
    output    [ARBITER_WIDTH-1            :    0]    grant;
579
    output                                            any_grant;
580
    input   [ARBITER_WIDTH-1            :   0]  priority_in;
581
 
582
    wire        [ARBITER_WIDTH-1             :    0]    termo1,termo2,mux_out,masked_request,edge_mask;
583
    wire        [ARBITER_WIDTH-1             :    0]    pr;
584
 
585
 
586
    thermo_gen #(
587
        .WIDTH(ARBITER_WIDTH)
588
    ) tm1
589
    (
590
        .in(request),
591
        .out(termo1)
592
    );
593
 
594
 
595
 
596
 
597
    thermo_gen #(
598
        .WIDTH(ARBITER_WIDTH)
599
    ) tm2
600
    (
601
        .in(masked_request),
602
        .out(termo2)
603
    );
604
 
605
 
606
    thermo_gen #(
607
        .WIDTH(ARBITER_WIDTH)
608
    ) tm3
609
    (
610
        .in(priority_in),
611
        .out(pr)
612
    );
613
 
614
 
615
assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
616
assign masked_request= request & pr;
617
assign any_grant=termo1[ARBITER_WIDTH-1];
618
 
619
 
620
assign edge_mask= {mux_out[ARBITER_WIDTH-2:0],1'b0};
621
assign grant= mux_out ^ edge_mask;
622
 
623
 
624
 
625
endmodule
626
 
627
 
628
 
629
/********************************
630
*
631
*   Tree arbiter
632
*
633
*******************************/
634
 
635
module tree_arbiter #(
636
        parameter    GROUP_NUM        =4,
637
        parameter    ARBITER_WIDTH    =16
638
)
639
(
640
   clk,
641
   reset,
642
   request,
643
   grant,
644
   any_grant
645
);
646
 
647
 
648
    function integer log2;
649
      input integer number; begin
650
         log2=(number <=1) ? 1: 0;
651
         while(2**log2<number) begin
652
            log2=log2+1;
653
         end
654
      end
655
    endfunction // log2 
656
 
657
  localparam N = ARBITER_WIDTH;
658
  localparam S = log2(ARBITER_WIDTH); // ceil of log_2 of N - put manually
659
 
660
 
661
  // I/O interface
662
  input           clk;
663
  input           reset;
664
  input  [N-1:0]  request;
665
  output [N-1:0]  grant;
666
  output          any_grant;
667
 
668
 
669
    localparam GROUP_WIDTH    =    ARBITER_WIDTH/GROUP_NUM;
670
 
671
  wire [GROUP_WIDTH-1        :    0]    group_req    [GROUP_NUM-1        :    0];
672
  wire [GROUP_WIDTH-1        :    0]    group_grant [GROUP_NUM-1        :    0];
673
  wire [GROUP_WIDTH-1        :    0]    grant_masked[GROUP_NUM-1        :    0];
674
 
675
  wire [GROUP_NUM-1            :    0] any_group_member_req;
676
  wire [GROUP_NUM-1            :    0] any_group_member_grant;
677
 
678
 
679
    genvar i;
680
    generate
681
    for (i=0;i<GROUP_NUM;i=i+1) begin :group_lp
682
 
683
        //seprate inputs in group
684
        assign group_req[i]    =    request[(i+1)*GROUP_WIDTH-1        :    i*GROUP_WIDTH];
685
 
686
        //check if any member of qrup has request
687
        assign any_group_member_req[i]    =    | group_req[i];
688
 
689
        //arbiterate one request from each group
690
        arbiter #(
691
            .ARBITER_WIDTH    (GROUP_WIDTH)
692
        )group_member_arbiter
693
        (
694
            .clk            (clk),
695
            .reset        (reset),
696
            .request        (group_req[i]),
697
            .grant        (group_grant[i]),
698
            .any_grant    ()
699
        );
700
 
701
    // mask the non selected groups        
702
        assign grant_masked [i] = (any_group_member_grant[i])?    group_grant[i]: {GROUP_WIDTH{1'b0}};
703
 
704
    //assemble the grants
705
        assign grant [(i+1)*GROUP_WIDTH-1        :    i*GROUP_WIDTH] = grant_masked [i];
706
 
707
 
708
    end
709
    endgenerate
710
 
711
    //select one group which has atleast one active request
712
 
713
    //arbiterate one request from each group
714
        arbiter #(
715
            .ARBITER_WIDTH    (GROUP_NUM)
716
        )second_arbiter
717
        (
718
            .clk        (clk),
719
            .reset        (reset),
720
            .request    (any_group_member_req),
721
            .grant        (any_group_member_grant),
722
            .any_grant    (any_grant)
723
        );
724
 
725
 
726
 
727
 endmodule
728
 
729
 
730
 
731
 
732
 
733
 
734
/*******************************
735
 
736
    my_one_hot_arbiter_ext_priority
737
 
738
*******************************/
739
 
740
module my_one_hot_arbiter_ext_priority #(
741
    parameter ARBITER_WIDTH =4
742
 
743
 
744
)
745
(
746
    input   [ARBITER_WIDTH-1            :   0]  request,
747
    input   [ARBITER_WIDTH-1            :   0]  priority_in,
748
    output  [ARBITER_WIDTH-1            :   0]  grant,
749
    output                                      any_grant
750
);
751
 
752
    function integer log2;
753
      input integer number; begin
754
         log2=(number <=1) ? 1: 0;
755
         while(2**log2<number) begin
756
            log2=log2+1;
757
         end
758
      end
759
    endfunction // log2 
760
 
761
    localparam ARBITER_BIN_WIDTH= log2(ARBITER_WIDTH);
762
    wire    [ARBITER_BIN_WIDTH-1        :   0]  low_pr;
763
 
764
 
765
    wire [ARBITER_WIDTH-1            :   0] low_pr_one_hot = {priority_in[0],priority_in[ARBITER_BIN_WIDTH-1:1]};
766
 
767
    one_hot_to_bin #(
768
        .ONE_HOT_WIDTH    (ARBITER_WIDTH)
769
    )conv
770
    (
771
        .one_hot_code(low_pr_one_hot),
772
        .bin_code(low_pr)
773
    );
774
 
775
 
776
    assign any_grant = | request;
777
 
778
    generate
779
        if(ARBITER_WIDTH    ==2) begin: w2       arbiter_2_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
780
        if(ARBITER_WIDTH    ==3) begin: w3       arbiter_3_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
781
        if(ARBITER_WIDTH    ==4) begin: w4       arbiter_4_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
782
    endgenerate
783
 
784
endmodule
785
 
786
 
787
/*********************************
788
*
789
*       arbiter_ext_priority
790
*
791
**********************************/
792
 
793
 
794
 module arbiter_ext_priority  #(
795
        parameter   ARBITER_WIDTH   =8
796
 
797
)
798
(
799
 
800
   request,
801
   grant,
802
   priority_in,
803
   any_grant
804
);
805
 
806
 
807
    input   [ARBITER_WIDTH-1            :   0]  request;
808
    input   [ARBITER_WIDTH-1            :   0]  priority_in;
809
    output  [ARBITER_WIDTH-1            :   0]  grant;
810
    output                                      any_grant;
811
 
812
   /*
813
    generate
814
 
815
    if(ARBITER_WIDTH<=4) begin :ws4
816
        //my own arbiter
817
        my_one_hot_arbiter_ext_priority #(
818
            .ARBITER_WIDTH  (ARBITER_WIDTH)
819
        )
820
        one_hot_arb
821
        (
822
 
823
            .request    (request),
824
            .priority_in(priority_in),
825
            .grant      (grant),
826
            .any_grant  (any_grant)
827
        );
828
 
829
    end else begin :wb4
830
    */
831
 
832
        thermo_arbiter_ext_priority #(
833
            .ARBITER_WIDTH  (ARBITER_WIDTH)
834
        )
835
        one_hot_arb
836
        (
837
 
838
            .request    (request),
839
            .priority_in(priority_in),
840
            .grant      (grant),
841
            .any_grant   (any_grant)
842
        );
843
   // end
844
   // endgenerate
845
 
846
 
847
 
848
 
849
endmodule
850
 
851
 
852
 
853
 
854
 
855
 
856
 
857
 
858
 
859
 /*
860
 module fixed_priority_arbiter #(
861
     parameter   ARBITER_WIDTH   =8,
862
     parameter   HIGH_PRORITY_BIT = "HSB"
863
 )
864
 (
865
 
866
   request,
867
   grant,
868
   any_grant
869
);
870
 
871
 
872
    input   [ARBITER_WIDTH-1            :   0]  request;
873
    output  [ARBITER_WIDTH-1            :   0]  grant;
874
    output                                      any_grant;
875
 
876
    wire    [ARBITER_WIDTH-1            :   0]  cout;
877
    reg     [ARBITER_WIDTH-1            :   0]  cin;
878
 
879
 
880
    assign  any_grant= | request;
881
 
882
    assign grant    = cin & request;
883
    assign cout     = cin & ~request;
884
 
885
     always @(*) begin
886
        if( HIGH_PRORITY_BIT == "HSB")  cin      = {1'b1, cout[ARBITER_WIDTH-1 :1]}; // hsb has highest priority
887
        else                            cin      = {cout[ARBITER_WIDTH-2 :0] ,1'b1}; // lsb has highest priority
888
    end//always
889
endmodule
890
 
891
*/
892
 
893
 
894
 
895
 

powered by: WebSVN 2.1.0

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