新手上路
- 积分
- 39
- 金钱
- 39
- 注册时间
- 2020-3-18
- 在线时间
- 12 小时
|
仿真时出现警告,请问哪里出了问题?
Warning (10230): Verilog HDL assignment warning at bps_gen.v(42): truncated value with size 32 to match size of target (21)
reg [12:0] bps_gen_cnt;
reg [12:0] bps_gen_cnt_max;
reg [3:0] bps_cnt;
parameter sys_clock = 50_000_000;
localparam bps_9600 = sys_clock / 9600 - 1;
localparam bps_19200 = sys_clock / 19200 - 1;
localparam bps_38400 = sys_clock / 38400 - 1;
localparam bps_57600 = sys_clock / 57600 - 1;
localparam bps_115200 = sys_clock / 115200 - 1;
localparam bps_230400 = sys_clock / 230400 - 1;
localparam bps_460800 = sys_clock / 460800 - 1;
localparam bps_921600 = sys_clock / 921600 - 1;
always @(posedge clk or negedge rst_n)
if(!rst_n)
bps_gen_cnt_max <= bps_9600;
else
begin
case(baud_set)
3'd0:bps_gen_cnt_max <= bps_9600;
3'd1:bps_gen_cnt_max <= bps_19200;
3'd2:bps_gen_cnt_max <= bps_38400;
3'd3:bps_gen_cnt_max <= bps_57600;
3'd4:bps_gen_cnt_max <= bps_115200;
3'd5:bps_gen_cnt_max <= bps_230400;
3'd6:bps_gen_cnt_max <= bps_460800;
3'd7:bps_gen_cnt_max <= bps_921600;
default:bps_gen_cnt_max <= bps_9600;
endcase
end
|
|