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] - Diff between revs 48 and 54

Show entire file | Details | Blame | View Log

Rev 48 Rev 54
Line 32... Line 32...
*
*
* general round robin arbiter
* general round robin arbiter
*
*
*
*
******************************************/
******************************************/
 
`include "pronoc_def.v"
 
 
 
 
 
 
module arbiter #(
module arbiter #(
    parameter    ARBITER_WIDTH    =8
    parameter    ARBITER_WIDTH    =8
 
 
)
)
Line 205... Line 208...
    .one_hot_code(grant),
    .one_hot_code(grant),
    .bin_code(grant_bcd)
    .bin_code(grant_bcd)
 
 
    );
    );
 
 
`ifdef SYNC_RESET_MODE
    always @ (`pronoc_clk_reset_edge )begin
    always @ (posedge clk )begin
        if(`pronoc_reset) begin
`else
 
    always @ (posedge clk or posedge reset)begin
 
`endif
 
 
 
        if(reset) begin
 
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
        end else begin
        end else begin
            if(any_grant) low_pr <= grant_bcd;
            if(any_grant) low_pr <= grant_bcd;
        end
        end
    end
    end
Line 354... Line 352...
    (
    (
        .one_hot_code(grant),
        .one_hot_code(grant),
        .bin_code(grant_bcd)
        .bin_code(grant_bcd)
    );
    );
 
 
`ifdef SYNC_RESET_MODE
    always @ (`pronoc_clk_reset_edge )begin
    always @ (posedge clk )begin
        if(`pronoc_reset) begin
`else
 
    always @ (posedge clk or posedge reset)begin
 
`endif
 
        if(reset) begin
 
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
            low_pr    <=    {ARBITER_BIN_WIDTH{1'b0}};
        end else begin
        end else begin
            if(priority_en) low_pr <= grant_bcd;
            if(priority_en) low_pr <= grant_bcd;
        end
        end
    end
    end
Line 454... Line 448...
 
 
assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
assign masked_request= request & pr;
assign masked_request= request & pr;
assign any_grant=termo1[ARBITER_WIDTH-1];
assign any_grant=termo1[ARBITER_WIDTH-1];
 
 
`ifdef SYNC_RESET_MODE
    always @ (`pronoc_clk_reset_edge )begin
    always @ (posedge clk )begin
            if(`pronoc_reset) pr<= {ARBITER_WIDTH{1'b1}};
`else
 
    always @ (posedge clk or posedge reset)begin
 
`endif
 
 
 
    if(reset) pr<= {ARBITER_WIDTH{1'b1}};
 
    else begin
    else begin
        if(any_grant) pr<= edge_mask;
        if(any_grant) pr<= edge_mask;
    end
    end
 
 
end
end
Line 528... Line 517...
 
 
    assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
    assign mux_out=(termo2[ARBITER_WIDTH-1])? termo2 : termo1;
    assign masked_request= request & pr;
    assign masked_request= request & pr;
    assign any_grant=termo1[ARBITER_WIDTH-1];
    assign any_grant=termo1[ARBITER_WIDTH-1];
 
 
`ifdef SYNC_RESET_MODE
    always @ (`pronoc_clk_reset_edge )begin
    always @ (posedge clk )begin
            if(`pronoc_reset) pr<= {ARBITER_WIDTH{1'b1}};
`else
 
    always @ (posedge clk or posedge reset)begin
 
`endif
 
 
 
    if(reset) pr<= {ARBITER_WIDTH{1'b1}};
 
    else begin
    else begin
        if(priority_en) pr<= edge_mask;
        if(priority_en) pr<= edge_mask;
    end
    end
 
 
end
end
Line 869... Line 853...
 
 
 
 
    input   [ARBITER_WIDTH-1            :   0]  request;
    input   [ARBITER_WIDTH-1            :   0]  request;
    output  [ARBITER_WIDTH-1            :   0]  grant;
    output  [ARBITER_WIDTH-1            :   0]  grant;
    output                                      any_grant;
    output                                      any_grant;
 
   /*
 
    wire    [ARBITER_WIDTH-1            :   0]  cout;
 
    reg     [ARBITER_WIDTH-1            :   0]  cin;
 
 
    wire    [ARBITER_WIDTH-1            :   0]  cout;
 
    reg     [ARBITER_WIDTH-1            :   0]  cin;
 
 
 
 
 
 
 
 
    assign grant    = cin & request;
 
    assign cout     = cin & ~request;
 
 
 
     always @(*) begin
 
        if( HIGH_PRORITY_BIT == "HSB")  cin      = {1'b1, cout[ARBITER_WIDTH-1 :1]}; // hsb has highest priority
 
        else                            cin      = {cout[ARBITER_WIDTH-2 :0] ,1'b1}; // lsb has highest priority
 
    end//always
 
 
 
    */
 
 
    assign  any_grant= | request;
    assign  any_grant= | request;
 
    wire  [ARBITER_WIDTH-1            :   0] termo_code, edge_mask;
 
 
 
 
 
    genvar i;
 
    generate
 
    if( HIGH_PRORITY_BIT == "LSB") begin :hsb
 
        for(i=0;i<ARBITER_WIDTH;i=i+1)begin :lp
 
            assign termo_code[i]= | request[i    :0];
 
        end
 
        assign edge_mask=  {termo_code[ARBITER_WIDTH-2:0],1'b0};
 
 
 
    end else begin :hsb
 
        for(i=0;i<ARBITER_WIDTH;i=i+1)begin :lp
 
            assign termo_code[i]= | request[ARBITER_WIDTH-1    :i];
 
        end
 
        assign edge_mask=  {1'b0, termo_code[ARBITER_WIDTH-1:1]};
 
 
 
    end
 
    endgenerate
 
 
 
    assign grant= termo_code ^ edge_mask;
 
 
 
 
    assign grant    = cin & request;
 
    assign cout     = cin & ~request;
 
 
 
     always @(*) begin
 
        if( HIGH_PRORITY_BIT == "HSB")  cin      = {1'b1, cout[ARBITER_WIDTH-1 :1]}; // hsb has highest priority
 
        else                            cin      = {cout[ARBITER_WIDTH-2 :0] ,1'b1}; // lsb has highest priority
 
    end//always
 
endmodule
endmodule
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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