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/] [rtl/] [arbiter.v] - Blame information for rev 48

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 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
`ifdef SYNC_RESET_MODE
211
    always @ (posedge clk )begin
212
`else
213
    always @ (posedge clk or posedge reset)begin
214
`endif
215
 
216
        if(reset) begin
217
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
218
        end else begin
219
            if(any_grant) low_pr <= grant_bcd;
220
        end
221
    end
222
 
223
 
224
    assign any_grant = | request;
225
 
226
    generate
227
        if(ARBITER_WIDTH    ==2) begin: w2        arbiter_2_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
228
        if(ARBITER_WIDTH    ==3) begin: w3        arbiter_3_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
229
        if(ARBITER_WIDTH    ==4) begin: w4        arbiter_4_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
230
    endgenerate
231
 
232
endmodule
233
 
234
 
235
module arbiter_2_one_hot(
236
     input      [1             :    0]    in,
237
     output    reg[1                :    0]    out,
238
     input                                low_pr
239
);
240
always @(*) begin
241
     out=2'b00;
242
      case(low_pr)
243
         1'd0:
244
             if(in[1])                 out=2'b10;
245
             else if(in[0])         out=2'b01;
246
         1'd1:
247
             if(in[0])                 out=2'b01;
248
             else if(in[1])         out=2'b10;
249
          default: out=2'b00;
250
     endcase
251
  end
252
 endmodule
253
 
254
 
255
 
256
 
257
module arbiter_3_one_hot(
258
     input      [2             :    0]    in,
259
     output    reg[2                :    0]    out,
260
     input        [1                :    0]    low_pr
261
);
262
always @(*) begin
263
  out=3'b000;
264
      case(low_pr)
265
         2'd0:
266
             if(in[1])                 out=3'b010;
267
             else if(in[2])         out=3'b100;
268
             else if(in[0])         out=3'b001;
269
         2'd1:
270
             if(in[2])                 out=3'b100;
271
             else if(in[0])         out=3'b001;
272
             else if(in[1])         out=3'b010;
273
         2'd2:
274
             if(in[0])                 out=3'b001;
275
             else if(in[1])         out=3'b010;
276
             else if(in[2])         out=3'b100;
277
         default: out=3'b000;
278
     endcase
279
  end
280
 endmodule
281
 
282
 
283
 module arbiter_4_one_hot(
284
     input      [3             :    0]    in,
285
     output    reg[3                :    0]    out,
286
     input        [1                :    0]    low_pr
287
);
288
always @(*) begin
289
  out=4'b0000;
290
      case(low_pr)
291
         2'd0:
292
             if(in[1])                 out=4'b0010;
293
             else if(in[2])         out=4'b0100;
294
             else if(in[3])         out=4'b1000;
295
             else if(in[0])         out=4'b0001;
296
         2'd1:
297
             if(in[2])                 out=4'b0100;
298
             else if(in[3])         out=4'b1000;
299
             else if(in[0])         out=4'b0001;
300
             else if(in[1])         out=4'b0010;
301
         2'd2:
302
             if(in[3])                 out=4'b1000;
303
             else if(in[0])         out=4'b0001;
304
             else if(in[1])         out=4'b0010;
305
             else if(in[2])         out=4'b0100;
306
         2'd3:
307
             if(in[0])                 out=4'b0001;
308
             else if(in[1])         out=4'b0010;
309
             else if(in[2])         out=4'b0100;
310
             else if(in[3])         out=4'b1000;
311
         default: out=4'b0000;
312
     endcase
313
  end
314
 endmodule
315
 
316
 
317
/******************************************************
318
*       my_one_hot_arbiter_priority_en
319
*
320
******************************************************/
321
 
322
 
323
 
324
module my_one_hot_arbiter_priority_en #(
325
    parameter ARBITER_WIDTH    =4
326
 
327
 
328
)
329
(
330
    input        [ARBITER_WIDTH-1             :    0]    request,
331
    output    [ARBITER_WIDTH-1            :    0]    grant,
332
    output                                            any_grant,
333
    input                                                clk,
334
    input                                                reset,
335
    input                                                priority_en
336
);
337
 
338
    function integer log2;
339
      input integer number; begin
340
         log2=(number <=1) ? 1: 0;
341
         while(2**log2<number) begin
342
            log2=log2+1;
343
         end
344
      end
345
    endfunction // log2 
346
 
347
    localparam ARBITER_BIN_WIDTH= log2(ARBITER_WIDTH);
348
    reg     [ARBITER_BIN_WIDTH-1        :    0]     low_pr;
349
    wire     [ARBITER_BIN_WIDTH-1        :    0]     grant_bcd;
350
 
351
    one_hot_to_bin #(
352
        .ONE_HOT_WIDTH    (ARBITER_WIDTH)
353
    )conv
354
    (
355
        .one_hot_code(grant),
356
        .bin_code(grant_bcd)
357
    );
358
 
359
`ifdef SYNC_RESET_MODE
360
    always @ (posedge clk )begin
361
`else
362
    always @ (posedge clk or posedge reset)begin
363
`endif
364
        if(reset) begin
365
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
366
        end else begin
367
            if(priority_en) low_pr <= grant_bcd;
368
        end
369
    end
370
 
371
 
372
    assign any_grant = | request;
373
 
374
    generate
375
        if(ARBITER_WIDTH    ==2) begin :w2        arbiter_2_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
376
        if(ARBITER_WIDTH    ==3) begin :w3        arbiter_3_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
377
        if(ARBITER_WIDTH    ==4) begin :w4        arbiter_4_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
378
    endgenerate
379
 
380
endmodule
381
 
382
 
383
 
384
/*******************
385
*
386
*    thermo_arbiter RRA
387
*
388
********************/
389
 
390
module thermo_gen #(
391
    parameter WIDTH=16
392
 
393
 
394
)(
395
    input  [WIDTH-1    :    0]in,
396
    output [WIDTH-1    :    0]out
397
);
398
    genvar i;
399
    generate
400
    for(i=0;i<WIDTH;i=i+1)begin :lp
401
        assign out[i]= | in[i    :0];
402
    end
403
    endgenerate
404
 
405
endmodule
406
 
407
 
408
 
409
 
410
module thermo_arbiter #(
411
 parameter    ARBITER_WIDTH    =4
412
 
413
)
414
(
415
   clk,
416
   reset,
417
   request,
418
   grant,
419
   any_grant
420
);
421
 
422
 
423
 
424
 
425
    input        [ARBITER_WIDTH-1             :    0]    request;
426
    output    [ARBITER_WIDTH-1            :    0]    grant;
427
    output                                            any_grant;
428
    input                                                reset,clk;
429
 
430
 
431
    wire        [ARBITER_WIDTH-1             :    0]    termo1,termo2,mux_out,masked_request,edge_mask;
432
    reg        [ARBITER_WIDTH-1             :    0]    pr;
433
 
434
 
435
    thermo_gen #(
436
        .WIDTH(ARBITER_WIDTH)
437
    ) tm1
438
    (
439
        .in(request),
440
        .out(termo1)
441
    );
442
 
443
 
444
 
445
 
446
    thermo_gen #(
447
        .WIDTH(ARBITER_WIDTH)
448
    ) tm2
449
    (
450
        .in(masked_request),
451
        .out(termo2)
452
    );
453
 
454
 
455
assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
456
assign masked_request= request & pr;
457
assign any_grant=termo1[ARBITER_WIDTH-1];
458
 
459
`ifdef SYNC_RESET_MODE
460
    always @ (posedge clk )begin
461
`else
462
    always @ (posedge clk or posedge reset)begin
463
`endif
464
 
465
    if(reset) pr<= {ARBITER_WIDTH{1'b1}};
466
    else begin
467
        if(any_grant) pr<= edge_mask;
468
    end
469
 
470
end
471
 
472
assign edge_mask= {mux_out[ARBITER_WIDTH-2:0],1'b0};
473
assign grant= mux_out ^ edge_mask;
474
 
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
`ifdef SYNC_RESET_MODE
534
    always @ (posedge clk )begin
535
`else
536
    always @ (posedge clk or posedge reset)begin
537
`endif
538
 
539
    if(reset) pr<= {ARBITER_WIDTH{1'b1}};
540
    else begin
541
        if(priority_en) pr<= edge_mask;
542
    end
543
 
544
end
545
 
546
assign edge_mask= {mux_out[ARBITER_WIDTH-2:0],1'b0};
547
assign grant= mux_out ^ edge_mask;
548
 
549
 
550
 
551
endmodule
552
 
553
 
554
 
555
 
556
 
557
 
558
 
559
 
560
module thermo_arbiter_ext_priority #(
561
 parameter    ARBITER_WIDTH    =4
562
 
563
)
564
(
565
 
566
   request,
567
   grant,
568
   any_grant,
569
   priority_in
570
 
571
);
572
 
573
 
574
 
575
 
576
    input        [ARBITER_WIDTH-1             :    0]    request;
577
    output    [ARBITER_WIDTH-1            :    0]    grant;
578
    output                                            any_grant;
579
    input   [ARBITER_WIDTH-1            :   0]  priority_in;
580
 
581
    wire        [ARBITER_WIDTH-1             :    0]    termo1,termo2,mux_out,masked_request,edge_mask;
582
    wire        [ARBITER_WIDTH-1             :    0]    pr;
583
 
584
 
585
    thermo_gen #(
586
        .WIDTH(ARBITER_WIDTH)
587
    ) tm1
588
    (
589
        .in(request),
590
        .out(termo1)
591
    );
592
 
593
 
594
 
595
 
596
    thermo_gen #(
597
        .WIDTH(ARBITER_WIDTH)
598
    ) tm2
599
    (
600
        .in(masked_request),
601
        .out(termo2)
602
    );
603
 
604
 
605
    thermo_gen #(
606
        .WIDTH(ARBITER_WIDTH)
607
    ) tm3
608
    (
609
        .in(priority_in),
610
        .out(pr)
611
    );
612
 
613
 
614
assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
615
assign masked_request= request & pr;
616
assign any_grant=termo1[ARBITER_WIDTH-1];
617
 
618
 
619
assign edge_mask= {mux_out[ARBITER_WIDTH-2:0],1'b0};
620
assign grant= mux_out ^ edge_mask;
621
 
622
 
623
 
624
endmodule
625
 
626
 
627
 
628
/********************************
629
*
630
*   Tree arbiter
631
*
632
*******************************/
633
 
634
module tree_arbiter #(
635
        parameter    GROUP_NUM        =4,
636
        parameter    ARBITER_WIDTH    =16
637
)
638
(
639
   clk,
640
   reset,
641
   request,
642
   grant,
643
   any_grant
644
);
645
 
646
 
647
    function integer log2;
648
      input integer number; begin
649
         log2=(number <=1) ? 1: 0;
650
         while(2**log2<number) begin
651
            log2=log2+1;
652
         end
653
      end
654
    endfunction // log2 
655
 
656
  localparam N = ARBITER_WIDTH;
657
  localparam S = log2(ARBITER_WIDTH); // ceil of log_2 of N - put manually
658
 
659
 
660
  // I/O interface
661
  input           clk;
662
  input           reset;
663
  input  [N-1:0]  request;
664
  output [N-1:0]  grant;
665
  output          any_grant;
666
 
667
 
668
    localparam GROUP_WIDTH    =    ARBITER_WIDTH/GROUP_NUM;
669
 
670
  wire [GROUP_WIDTH-1        :    0]    group_req    [GROUP_NUM-1        :    0];
671
  wire [GROUP_WIDTH-1        :    0]    group_grant [GROUP_NUM-1        :    0];
672
  wire [GROUP_WIDTH-1        :    0]    grant_masked[GROUP_NUM-1        :    0];
673
 
674
  wire [GROUP_NUM-1            :    0] any_group_member_req;
675
  wire [GROUP_NUM-1            :    0] any_group_member_grant;
676
 
677
 
678
    genvar i;
679
    generate
680
    for (i=0;i<GROUP_NUM;i=i+1) begin :group_lp
681
 
682
        //seprate inputs in group
683
        assign group_req[i]    =    request[(i+1)*GROUP_WIDTH-1        :    i*GROUP_WIDTH];
684
 
685
        //check if any member of qrup has request
686
        assign any_group_member_req[i]    =    | group_req[i];
687
 
688
        //arbiterate one request from each group
689
        arbiter #(
690
            .ARBITER_WIDTH    (GROUP_WIDTH)
691
        )group_member_arbiter
692
        (
693
            .clk            (clk),
694
            .reset        (reset),
695
            .request        (group_req[i]),
696
            .grant        (group_grant[i]),
697
            .any_grant    ()
698
        );
699
 
700
    // mask the non selected groups        
701
        assign grant_masked [i] = (any_group_member_grant[i])?    group_grant[i]: {GROUP_WIDTH{1'b0}};
702
 
703
    //assemble the grants
704
        assign grant [(i+1)*GROUP_WIDTH-1        :    i*GROUP_WIDTH] = grant_masked [i];
705
 
706
 
707
    end
708
    endgenerate
709
 
710
    //select one group which has atleast one active request
711
 
712
    //arbiterate one request from each group
713
        arbiter #(
714
            .ARBITER_WIDTH    (GROUP_NUM)
715
        )second_arbiter
716
        (
717
            .clk        (clk),
718
            .reset        (reset),
719
            .request    (any_group_member_req),
720
            .grant        (any_group_member_grant),
721
            .any_grant    (any_grant)
722
        );
723
 
724
 
725
 
726
 endmodule
727
 
728
 
729
 
730
 
731
 
732
 
733
/*******************************
734
 
735
    my_one_hot_arbiter_ext_priority
736
 
737
*******************************/
738
 
739
module my_one_hot_arbiter_ext_priority #(
740
    parameter ARBITER_WIDTH =4
741
 
742
 
743
)
744
(
745
    input   [ARBITER_WIDTH-1            :   0]  request,
746
    input   [ARBITER_WIDTH-1            :   0]  priority_in,
747
    output  [ARBITER_WIDTH-1            :   0]  grant,
748
    output                                      any_grant
749
);
750
 
751
    function integer log2;
752
      input integer number; begin
753
         log2=(number <=1) ? 1: 0;
754
         while(2**log2<number) begin
755
            log2=log2+1;
756
         end
757
      end
758
    endfunction // log2 
759
 
760
    localparam ARBITER_BIN_WIDTH= log2(ARBITER_WIDTH);
761
    wire    [ARBITER_BIN_WIDTH-1        :   0]  low_pr;
762
 
763
 
764
    wire [ARBITER_WIDTH-1            :   0] low_pr_one_hot = {priority_in[0],priority_in[ARBITER_BIN_WIDTH-1:1]};
765
 
766
    one_hot_to_bin #(
767
        .ONE_HOT_WIDTH    (ARBITER_WIDTH)
768
    )conv
769
    (
770
        .one_hot_code(low_pr_one_hot),
771
        .bin_code(low_pr)
772
    );
773
 
774
 
775
    assign any_grant = | request;
776
 
777
    generate
778
        if(ARBITER_WIDTH    ==2) begin: w2       arbiter_2_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
779
        if(ARBITER_WIDTH    ==3) begin: w3       arbiter_3_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
780
        if(ARBITER_WIDTH    ==4) begin: w4       arbiter_4_one_hot arb( .in(request) , .out(grant), .low_pr(low_pr)); end
781
    endgenerate
782
 
783
endmodule
784
 
785
 
786
/*********************************
787
*
788
*       arbiter_ext_priority
789
*
790
**********************************/
791
 
792
 
793
 module arbiter_ext_priority  #(
794
        parameter   ARBITER_WIDTH   =8
795
 
796
)
797
(
798
 
799
   request,
800
   grant,
801
   priority_in,
802
   any_grant
803
);
804
 
805
 
806
    input   [ARBITER_WIDTH-1            :   0]  request;
807
    input   [ARBITER_WIDTH-1            :   0]  priority_in;
808
    output  [ARBITER_WIDTH-1            :   0]  grant;
809
    output                                      any_grant;
810
 
811
   /*
812
    generate
813
 
814
    if(ARBITER_WIDTH<=4) begin :ws4
815
        //my own arbiter
816
        my_one_hot_arbiter_ext_priority #(
817
            .ARBITER_WIDTH  (ARBITER_WIDTH)
818
        )
819
        one_hot_arb
820
        (
821
 
822
            .request    (request),
823
            .priority_in(priority_in),
824
            .grant      (grant),
825
            .any_grant  (any_grant)
826
        );
827
 
828
    end else begin :wb4
829
    */
830
 
831
        thermo_arbiter_ext_priority #(
832
            .ARBITER_WIDTH  (ARBITER_WIDTH)
833
        )
834
        one_hot_arb
835
        (
836
 
837
            .request    (request),
838
            .priority_in(priority_in),
839
            .grant      (grant),
840
            .any_grant   (any_grant)
841
        );
842
   // end
843
   // endgenerate
844
 
845
 
846
 
847
 
848
endmodule
849
 
850
 
851
 
852
 
853
 
854
 
855
 
856
 
857
 
858
 
859
 module fixed_priority_arbiter #(
860
     parameter   ARBITER_WIDTH   =8,
861
     parameter   HIGH_PRORITY_BIT = "HSB"
862
 )
863
 (
864
 
865
   request,
866
   grant,
867
   any_grant
868
);
869
 
870
 
871
    input   [ARBITER_WIDTH-1            :   0]  request;
872
    output  [ARBITER_WIDTH-1            :   0]  grant;
873
    output                                      any_grant;
874
 
875
    wire    [ARBITER_WIDTH-1            :   0]  cout;
876
    reg     [ARBITER_WIDTH-1            :   0]  cin;
877
 
878
 
879
    assign  any_grant= | request;
880
 
881
    assign grant    = cin & request;
882
    assign cout     = cin & ~request;
883
 
884
     always @(*) begin
885
        if( HIGH_PRORITY_BIT == "HSB")  cin      = {1'b1, cout[ARBITER_WIDTH-1 :1]}; // hsb has highest priority
886
        else                            cin      = {cout[ARBITER_WIDTH-2 :0] ,1'b1}; // lsb has highest priority
887
    end//always
888
endmodule
889
 
890
 
891
 
892
 
893
 
894
 

powered by: WebSVN 2.1.0

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