I was following a tutorial to get started with Libero SoC with MicroSemi SmartFusion FPGA. I coded a small LED toggle module
module led_toggle( i_sw , o_led ); input wire [1:0] i_sw; output wire [4:0] o_led; assign o_led = i_sw; assign o_led = i_sw; assign o_led = i_sw & i_sw; assign o_led = i_sw | i_sw; assign o_led = i_sw ^ i_sw; endmodule
i_sw to on-board switch SW0 i_sw to on-board switch SW1 o_led[7:0] to on-board LEDs D[4:0]
After synthesis, place and rout, I flash the FPGA with the bitstream.
On pressing SW0, led D0 lights up and on pressing SW1, led D1 lights up. This is as expected.
However, it seems leds D2, D3 and D4 donot light up according to the AND, OR and EXOR combination of SW0 and SW1 as per my Verilog design. In fact working backwards from the behavior on-board, the logical expressions for them are
LED D2 = Sw0 | SW1 instead of designed (SW0 & SW1) LED D3 = SW0 & SW1 instead of designed (SW0 | SW1) LED D4 = ~(SW0 ^ SW1) instead of designed (SW0 | SW1)
Now in the same tutorial it is mentioned that
Keep in mind the switches and LEDs are active low. That is, the switch creates zero when pushed and the led illuminates when a logical 0 is applied.
So an active low switch with an active low LED is buffer like behavior i.e. LED ON when switch pressed and LED OFF when switch de-pressed. However it doesn't explain the unexpected behavior with leds D2, D3 and D4.
So what am I missing here ?