Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Gate functions dont work correctly on FPGA

Hello,i am new to the forum and to fpgas.I have recently bought a Cyclone FPGA from ebay with the ep1c3t144c8 chip on it,and have tried to do simple logic gate functions with the dip switches and the led's but they don't seem to operate correctly.For example,when I try to verify the and gate,it works like an or gate and vice versa.Other gates functions also dont work correctly.I also tried to simulate the project but there seems to be nothing wrong during simulation.Can it be a faulty fpga or am I doing something wrong?

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Most likely a coding error. If there was something wrong with the FPGA it would probably not power up at all.

    How about posting the code or the project?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Here is the code in VHDL:

    library ieee;

    use ieee.std_logic_1164.all;

    entity p1 is

    port( A, B : in std_logic;

    F : out std_logic);

    end p1;

    architecture func of p1 is

    begin

    F <= A and B;

    end func;
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Maybe your inputs are active low : it is common with push buttons. Button pressed means input = 0.

    maybe your LED is illuminating when output = 0.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The leds on most boards illuminate with a logic low output. Are you allowing for this?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you for your replies :).I think that's what's happening.Is there any way to change the active low of the push buttons and also make the led illuminate when the output is '1'?