资讯详情

轮询仲裁器和固定优先级仲裁器

仲裁器规则轮询 当0、1、2、、、、、N-1个source当信号源同时向仲裁器发出请求时,在初始情况下source 当仲裁器响应时,0的优先级最高source0后,source优先级最高,依次类推。 实现轮询仲裁器 轮询仲裁器的实现分为检测仲裁器输入口source信号源的request,根据当前仲裁器的优先级响应request,仲裁器grant输出source仲裁器更新的优先级。 0、1、2、3、4…优先级逐一排下 优先级排序ABC

根据输出信号作为状态机的转移条件

三个信号挂在总线上A,B,C,仲裁信号grant[1:0]。 grant[1:0]=2’b00 A获得总线 grant[1:0]=2’b01 B获得总线 grant[1:0]=2’b10 C获得总线 总线轮询算法: a.若目前只有一个信号请求,则不需仲裁,谁申请就可以占用总线。. b.如果没有请求,A将获得总线. c.考虑上一个请求信号,如果同时有多个信号请求, 如果上一个请求信号是A,所以轮询是BCA, 如果上一个请求信号是B,所以轮询是CAB, 如果上一个请求信号是C,所以轮询是ABC.

module bus_arbiter(clk,rst_n,arequest,brequest, crequest, grant);  // I/O definition input      clk; input      rst_n; input      arequest; input      brequest; input      crequest; output   [1:0] grant;  // register definition wire[1:0] grant; reg[1:0] nx_state,current_state; // wire definition wire[2:0] request_abc = {arequest, brequest, crequest};  parameter mastera=2'b00,masterb=2'b01,masterc=2'b10,rstate=2'b11;  //module part always @(posedge clk or negedge rst_n)   begin  if(!rst_n)        current_state <= rstate;  else        current_state <= nx_state;   end  always@(*)      begin   current_state <= mastera;   case(current_state)   mastera: //a    case(request_abc)    3'b000: nx_state <= mastera;    3'b001: nx_state <= masterc;    3'b010: nx_state <= masterb;    3'b100: nx_state <= mastera;    3'b011: nx_state <= masterb;    3'b101: nx_state <= masterc;    3'b110: nx_state <= masterb;    3'b111: nx_state <= masterb;    default: nx_state <= mastera;    endcase   masterb: //b    case(request_abc)    3'b000: nx_state <= mastera;    3'b001: nx_state <= masterc;    3'b010: nx_state <= masterb;    3'b100: nx_state <= mastera;    3'b011: nx_state <= masterc;    3'b101: nx_state <= masterc;    3'b110: nx_state <= mastera;    3'b111: nx_state <= masterc;    default: nx_state <= mastera;    endcase   masterc: //c    case(request_abc)    3'b000: nx_state <= mastera;    3'b001: nx_state <= masterc;    3'b010: nx_state <= masterb;    3'b100: nx_state <= mastera;    3'b011: nx_state <= masterb;    3'b101: nx_state <= mastera;    3'b110: nx_state <= mastera;    3'b111: nx_state <= mastera;    default: nx_state <= mastera;    endcase   default:nx_state <= mastera;   endcase  end assign grant = current_state;  endmodule  

固定优先级仲裁器规则 Fixed-priority Arbiter顾名思义,N-1个source同时发起request,Source 即使0的优先级最高,source0响应后仍为最高优先级,其中优先级按序号逐渐降低。 实现固定优先级仲裁 优先级仲裁器在固定FPGA与轮询仲裁器相似,唯一不同的是,轮询仲裁在每次响应后都会发生request优先级将更新,固定优先级不需要此步骤。

///固定优先级不变,保持A--B--C // 三个信号挂在总线上A,B,C,仲裁信号grant[1:0]。 // grant[1:0]=2’b00   A获得总线 // grant[1:0]=2’b01   B获得总线 // grant[1:0]=2’b10   C获得总线   `timescale 1ns/1ps module bus_arbiter2(clk, rst_n, signal_a, signal_b, signal_c, grant);  // I/O definition input      clk; input      rst_n; input      signal_a; input      signal_b; input      signal_c; output   [1:0] grant; // register definition reg   [1:0] grant;  // parameter definition parameter   s_null = 3'b000,             s_a    = 3'b100,             s_b    = 3'b010,             s_c    = 3'b001,             s_ab   = 3'b110,             s_bc   = 3'b001,             s_ac   = 3'b101,             s_abc  = 3'b111;  //module part and FSM always @(posedge clk or negedge rst_n) if(!rst_n)      // bus disable when negtive rst_n   begin    grant <= 2'b11;    //cs <= s_null;   end else   begin     case({signal_a, signal_b, signal_c})// bus enable with FSM       s_null:grant <= 2'b00;       s_a:   grant <= 2'b00;                       s_b:   grant <= 2'b01;               s_c:   grant <= 2'b10;               s_ab:  grant <= 2'b00;              s_bc:  grant <= 2'b01;       s_ac:  grant <= 2'b00;       s_abc: grant <= 2'b00;       default: grant <= 2'b00;                  endcase end endmodule  

总线仲裁器简单verilog实现_橙子的博客-CSDN博客_仲裁器verilog代码

标签: jk9301b01振动变送器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

 锐单商城 - 一站式电子元器件采购平台  

 深圳锐单电子有限公司