module jiaozhun(clk,rstn,bs,code,ST,code_out); input clk; input rstn; input bs; input[3:0] code; output[15:0] ST; output[4:0] code_out; reg[15:0] ST; reg[4:0] code_out; reg [4:0] dpt; wire [4:0] ppt_d; wire [5:0] ppt; wire [4:0] code_out_tmp; assign code_out_tmp = (bs)? ((code>=14)?(5'b10000)  code+2))  (code<=1)?(5'b00000)  code-1)); always @(posedge clk or negedge rstn) begin if(!rstn) dpt <= 5'b0; else if (code_out_tmp==16) dpt <= 5'b0; else dpt <= ppt_d; end assign ppt = code_out_tmp + dpt; assign ppt_d = ppt>16?ppt-16:ppt; reg[15:0] a; reg[15:0] b; always @(ppt_d) begin case(ppt_d) 5'b00000: a = 16'b0000000000000000; 5'b00001: a = 16'b0000000000000001; 5'b00010: a = 16'b0000000000000011; 5'b00011: a = 16'b0000000000000111; 5'b00100: a = 16'b0000000000001111; 5'b00101: a = 16'b0000000000011111; 5'b00110: a = 16'b0000000000111111; 5'b00111: a = 16'b0000000001111111; 5'b01000: a = 16'b0000000011111111; 5'b01001: a = 16'b0000000111111111; 5'b01010: a = 16'b0000001111111111; 5'b01011: a = 16'b0000011111111111; 5'b01100: a = 16'b0000111111111111; 5'b01101: a = 16'b0001111111111111; 5'b01110: a = 16'b0011111111111111; 5'b01111: a = 16'b0111111111111111; 5'b10000: a = 16'b1111111111111111; endcase end always @(dpt) begin case(dpt) 5'b00000: b = 16'b0000000000000000; 5'b00001: b = 16'b0000000000000001; 5'b00010: b = 16'b0000000000000011; 5'b00011: b = 16'b0000000000000111; 5'b00100: b = 16'b0000000000001111; 5'b00101: b = 16'b0000000000011111; 5'b00110: b = 16'b0000000000111111; 5'b00111: b = 16'b0000000001111111; 5'b01000: b = 16'b0000000011111111; 5'b01001: b = 16'b0000000111111111; 5'b01010: b = 16'b0000001111111111; 5'b01011: b = 16'b0000011111111111; 5'b01100: b = 16'b0000111111111111; 5'b01101: b = 16'b0001111111111111; 5'b01110: b = 16'b0011111111111111; 5'b01111: b = 16'b0111111111111111; 5'b10000: b = 16'b1111111111111111; endcase end wire [15:0] c; wire [15:0] d; assign c = a ^ b; assign d = ~c; wire [15:0] ST_tmp; assign ST_tmp = ppt>16?d:c; always @(posedge clk or negedge rstn) begin if(!rstn) begin ST <= 16'd0; code_out <= 5'b0; end else begin ST <= ST_tmp; code_out <= code_out_tmp; end end endmodule 请问一下,我这个代码,按图片上的脚本进行综合,出来的时序没问题,但生成的门级网表进行仿真时,仿真有问题,还显示锁存器有时序违例,如何解决呀
|