三模冗余设计
在数字电路设计中,Voter模块(表决器) 和 三模冗余(Triple Modular Redundancy, TMR) 是高可靠性系统的核心设计技术,主要用于容错和抗辐射(如航天、医疗设备等关键领域)。以下是其工作原理、实现方法及Verilog示例。
- 三模冗余(TMR)的基本原理
TMR通过三重冗余设计,对关键模块复制三份,通过表决器(Voter)输出多数一致的结果,屏蔽单点故障。
TMR系统结构
+---------+
输入 --->| 模块A |---> 结果A+---------+ |+---------+ v
输入 --->| 模块B |---> 结果B ---> Voter ---> 最终输出+---------+ ^+---------+ |
输入 --->| 模块C |---> 结果C+---------+
容错机制:若任一模块故障(如SEU,单粒子翻转),其他两个模块仍能保证正确输出。
- Voter模块的设计
Voter模块的核心功能是对三个输入进行多数表决,输出占多数的值。
逻辑表达式
Voter_out = (A & B) | (B & C) | (A & C)
- Verilog实现
(1) 基本Voter模块
module voter (input wire A, B, C, // 三个冗余模块的输出output wire out // 表决结果
);assign out = (A & B) | (B & C) | (A & C);
endmodule
(2) 带时序的Voter(防止亚稳态)
module voter_sync (input wire clk, // 系统时钟input wire rst_n, // 异步复位input wire A, B, C, // 冗余模块输出output reg out // 同步后的表决结果
);reg A_sync, B_sync, C_sync;// 同步输入信号(避免亚稳态)always @(posedge clk or negedge rst_n) beginif (!rst_n) beginA_sync <= 0;B_sync <= 0;C_sync <= 0;end else beginA_sync <= A;B_sync <= B;C_sync <= C;endend// 多数表决逻辑always @(posedge clk) beginout <= (A_sync & B_sync) | (B_sync & C_sync) | (A_sync & C_sync);end
endmodule
- TMR系统完整示例
以下是一个完整的TMR系统,包含三个冗余模块和一个Voter:
module tmr_system (input wire clk,input wire rst_n,input wire data_in, // 输入信号output wire data_out // 容错输出
);// 三个冗余模块wire result_a, result_b, result_c;module_a u_module_a (.clk(clk), .rst_n(rst_n), .in(data_in), .out(result_a));module_b u_module_b (.clk(clk), .rst_n(rst_n), .in(data_in), .out(result_b));module_c u_module_c (.clk(clk), .rst_n(rst_n), .in(data_in), .out(result_c));// Voter模块voter u_voter (.A(result_a),.B(result_b),.C(result_c),.out(data_out));
endmodule
-
应用场景
航天电子:抗辐射芯片(如FPGA)中用于防止单粒子翻转(SEU)。
医疗设备:心脏起搏器等关键系统需高可靠性。
工业控制:核电站、高铁等安全关键系统。 -
注意事项
功耗与面积:TMR会显著增加资源占用(约3倍),需权衡可靠性和成本。
时钟同步:三个冗余模块需严格同步时钟,避免相位差导致表决错误。
故障检测:可扩展设计以检测并隔离故障模块(如通过BIST)。