From 798f54c05376ec3b4ebbe8326d0a91eec807df3d Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 14 Nov 2019 16:27:19 +0000 Subject: Add proper reports to bugs --- bugs/vivado_3.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 bugs/vivado_3.md (limited to 'bugs/vivado_3.md') diff --git a/bugs/vivado_3.md b/bugs/vivado_3.md new file mode 100644 index 0000000..79fedd5 --- /dev/null +++ b/bugs/vivado_3.md @@ -0,0 +1,27 @@ +# Unsigned bit extension in if statement + +[ [Vivado forum 981789](https://forums.xilinx.com/t5/Synthesis/Vivado-2019-1-Unsigned-bit-extension-in-if-statement/td-p/981789) ] + +The code below does not seem to behave properly after synthesis with Vivado 2019.1. When the input to the module is `w1 = 2'b01`, then the output should be 0. This is because the unsigned literal `-1'b1` in the if statement is zero extended to 2 bits giving `-2'b01 = 2'b11`. + +As `2'b11 != w1` (which is `2'b01`), `r1` should never be set. + +However, instead of 0, after synthesis with Vivado, the output it 1. This seems to have something to do with the concatenation as well, as if that is removed, Vivado synthesis works as expected and performs the right zero extension. + +Assigning `r1` directly to `{-1'b1 == w1}` also works as expected. + +``` +module top (y, clk, w1); + output y; + input clk; + input signed [1:0] w1; + reg r1 = 1'b0; + assign y = r1; + + always @(posedge clk) + if ({-1'b1 == w1}) // when w1 = 2'b01 this should not be true + r1 <= 1'b1; +endmodule // top +``` + +This happens on Vivado 2019.1 on my Arch linux machine, and also hapens on Vivado 2018.3 on CentOS 6. -- cgit