I am developing a design based on ISE 14.7, Artix-7 CSG324 NEXYS4 eval board. For testing purpose, I wrote a simple clock divider code as following, but the compiler keeps warning me: Line 31(red line): Result of 32-bit expression is truncated to fit in 1-bit target. The RTL schematic looks the same as I expected, If ignore the warning and program the eval board, clock frequency wouldn't change when SW0 - SW3 input changed.
I wonder if it is because of compatible issue for the compiler(most people use vivado for artix-7)? But on the Xilinx website it says the ISE will support Artix-7CX7A100T.
Please let me know if you guys have any suggestions, Thanks ahead.
assign clk_o = (rst_n_i == 1'b0)? 0 : clk_o_s;
always @ (posedge clk_i) begin
if (rst_n_i == 1'b0) begin
clk_cnt <= 0;
end
else begin
clk_cnt <= clk_cnt + 1'b1; clk_o_s <= clk_cnt[ divider_i];
end
end
endmodule
Updates: The code when through now without warning, but after burn the code into NEXYS4 ddr board, it is not generating the output when I change the input.
Question
silverwolfman
Hi Everyone,
I am developing a design based on ISE 14.7, Artix-7 CSG324 NEXYS4 eval board. For testing purpose, I wrote a simple clock divider code as following, but the compiler keeps warning me: Line 31(red line): Result of 32-bit expression is truncated to fit in 1-bit target. The RTL schematic looks the same as I expected, If ignore the warning and program the eval board, clock frequency wouldn't change when SW0 - SW3 input changed.
I wonder if it is because of compatible issue for the compiler(most people use vivado for artix-7)? But on the Xilinx website it says the ISE will support Artix-7CX7A100T.
Please let me know if you guys have any suggestions, Thanks ahead.
module CLKDIVIDER(
input clk_i,
input rst_n_i,
input [3:0] divider_i,
output clk_o
);
reg [15:0] clk_cnt;
reg clk_o_s;
assign clk_o = (rst_n_i == 1'b0)? 0 : clk_o_s;
always @ (posedge clk_i) begin
if (rst_n_i == 1'b0) begin
clk_cnt <= 0;
end
else begin
clk_cnt <= clk_cnt + 1'b1;
clk_o_s <= clk_cnt[ divider_i];
end
end
endmodule
Updates: The code when through now without warning, but after burn the code into NEXYS4 ddr board, it is not generating the output when I change the input.
Test.zip
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.