I have been trying to design a simple Hardware design to controll another board that powers a set of LEDs for a stage drum lighting system. I cannot for the life of me figure out why I am recieving these warnings
In short what I am trying to do here is create a design that switches the lights color each time the Base drum (BaseBeat) is hit, with a maximum transition time of 1 light change a second (I am using a 50Mhz clock so I used a counter qtemp to count up and then reset after the BaseBeat is pressed) I have tested both the TB and the design on my Spartan3e but nothing happens (when I remove anything to do with the clock and the one second transition limit it works).
Also so far I have taken one course on VHDL and FPGA design, I will be taking more this spring, but I hope to have this working so I can set up the light system earlier.
these are the warnings
WARNING:Xst:646 - Signal is assigned but never used. This unconnected signal will be trimmed during the optimization process. WARNING:PhysDesignRules:367 - The signal is incomplete. The signal does not drive any load pins in the design. WARNING:Par:288 - The signal clk_IBUF has no load. PAR will not attempt to route this signal. WARNING:Par:283 - There are 1 loadless signals in this design. This design will cause Bitgen to issue DRC warnings.
(the next_color warning does not seem to be my major problem, although I could be wrong)
Here is my code:
entity LEDcontroller is
port( BaseBeat: in STD_LOGIC;
output,ON_BOARD_LED_output: out STD_LOGIC_VECTOR(2 downto 0);
color_scheme: in STD_LOGIC_VECTOR(1 downto 0);
ON_BOARD_LED_color_scheme: out STD_LOGIC_VECTOR(1 downto 0);
ON_BOARD_LED_BaseBeat: out STD_LOGIC;
ON_BOARD_LED_ONEsec_flag: out STD_LOGIC;
clk : in STD_LOGIC);
end LEDcontroller;
architecture controller_behavior of LEDcontroller is
type color_type is (RED, YELLOW, GREEN, TURQOISE, BLUE, PINK, WHITE, OFF);
signal current_color: color_type := OFF;
signal next_color: color_type := OFF;
signal outputTEMP: STD_LOGIC_VECTOR(2 downto 0); -- default is off
signal qtemp: STD_LOGIC_VECTOR(24 downto 0);
signal ONEsec_flag: STD_LOGIC;
begin
process(clk)
begin
if (clk'event and clk='1') then
qtemp <= qtemp + 1;
end if;
end process;
sequence: process(current_color,color_scheme)
begin
if (color_scheme = "00") then
case current_color is
when RED => next_color <= GREEN;
when GREEN => next_color <= BLUE;
when BLUE => next_color <= RED;
when OTHERS => next_color <= RED;
end case;
elsif (color_scheme = "01") then
case current_color is
when RED => next_color <= YELLOW;
when YELLOW => next_color <= GREEN;
when GREEN => next_color <= TURQOISE;
when TURQOISE => next_color <= BLUE;
when BLUE => next_color <= PINK;
when PINK => next_color <= RED;
when OTHERS => next_color <= RED;
end case;
elsif (color_scheme = "10") then
case current_color is
when RED => next_color <= PINK;
when PINK => next_color <= BLUE;
when BLUE => next_color <= TURQOISE;
when TURQOISE => next_color <= GREEN;
when GREEN => next_color <= YELLOW;
when YELLOW => next_color <= RED;
when OTHERS => next_color <= RED;
end case;
else
case current_color is
when RED => next_color <= BLUE;
when BLUE => next_color <= GREEN;
when GREEN => next_color <= WHITE;
when WHITE => next_color <= RED;
when OTHERS => next_color <= RED;
end case;
end if;
end process;
transition: process(BaseBeat,qtemp)
begin
if (qtemp = "10111110101111000010000000") then
ONEsec_flag <= '1';
end if;
if (BaseBeat'event and BaseBeat = '1') and (ONEsec_flag='1') then
current_color <= next_color;
ONEsec_flag <= '0';
else
current_color <= current_color;
end if;
end process;
control: process(current_color)
begin
case current_color is
-- main colors
when RED => outputTEMP <= "110";
when GREEN => outputTEMP <= "101";
when BLUE => outputTEMP <= "011";
--extended colors
when YELLOW => outputTEMP <= "100";
when TURQOISE => outputTEMP <= "001";
when PINK => outputTEMP <= "010";
--all or nothing
when WHITE => outputTEMP <= "000";
when OTHERS => outputTEMP <= "111";
end case;
end process;
--components
--main outputs
output <= outputTEMP;
-- on board led outputs
ON_BOARD_LED_output <= outputTEMP;
ON_BOARD_LED_color_scheme <= color_scheme;
ON_BOARD_LED_BaseBeat <= BaseBeat;
ON_BOARD_LED_ONEsec_flag<=ONEsec_flag;
end controller_behavior;
and my UCF:
# Clocks NET "clk" LOC = " B8 " ;#Bank = 0, Signal name = MCLK # Pin assignment for LEDs NET "ON_BOARD_LED_output" LOC = "G1" ; # Bank = 3, Signal name = LD7 NET "ON_BOARD_LED_output" LOC = "P4" ; # Bank = 2, Signal name = LD6 NET "ON_BOARD_LED_output" LOC = "N4" ; # Bank = 2, Signal name = LD5 NET "ON_BOARD_LED_BaseBeat" LOC = "P6" ; # Bank = 2, Signal name = LD3 NET "ON_BOARD_LED_color_scheme" LOC = "M11" ; # Bank = 2, Signal name = LD1 NET "ON_BOARD_LED_color_scheme" LOC = "M5" ; # Bank = 2, Signal name = LD0 NET "ON_BOARD_LED_ONEsec_flag" LOC = "P7" ; # Bank = 2, Signal name = LD5 NET "color_scheme" LOC = "L3"; # Bank = 3, Signal name = SW1 NET "color_scheme" LOC = "P11"; # Bank = 2, Signal name = SW0 NET "BaseBeat" LOC = "A7"; # Bank = 1, Signal name = BTN3 # Loop Back only tested signals #NET "BaseBeat" LOC = "C6" | DRIVE = 2 | PULLUP ; # Bank = 1, Signal name = JA1 NET "output" LOC = "B6" | DRIVE = 2 | PULLUP ; # Bank = 1, Signal name = JA2 NET "output" LOC = "C5" | DRIVE = 2 | PULLUP ; # Bank = 1, Signal name = JA3 NET "output" LOC = "B7" | DRIVE = 2 | PULLUP ; # Bank = 1, Signal name = JA4 #NET "BaseBeat" CLOCK_DEDICATED_ROUTE = FALSE;
Sorry that this is long, please help me though if you are able to, I have given myself several headaches reading my book and searching the forums all to no avail.
Thanks in advance,
Scott
EDIT:
in response to my own comment to @Paebbels' suggestions
@Paebbels I do have a new issue now, even after a second has passed the transition does not always occur when BaseBeat is pressed. When I hold BaseBeat down for a long time, the lights start transiting every second, but when I quickly press them even after a second it does not always transition, only some times. Oddly enough, if I press the BaseBeat for say 1/2 a second it doesn't always transition either? (I thought it may have something to do with rising_edg(clk) and BaseBeat not occurring at the same time, but rising_edg(clk) occurs 25M times in half a second..) Thanks again
I altered the suggested statement:
ONEsec_flag <= '1' when (qtemp = 49999999) else '0';
to be:
process(clk)
begin
if rising_edge(clk) then
if (qtemp = 49999999) then ONEsec_flag <= '1';
elsif (BaseBeat='1') then ONEsec_flag <= '0';
else ONEsec_flag <= ONEsec_flag;
end if;
end if;
end process;
Is this good design practice? it seems to be working now (it transitions after a second regardless of how long or fast I press the BaseBeat) and I think I made it synchronous, at least within my understanding of synchronous.
Thanks for all the help guys, especially you @Paebbels! have a Happy New Year!
if (clk'event and clk='1') then
\$\endgroup\$if (clk'event and clk='1') then
after that I got only scrambled lines. So not it's fixed and I extended my answer :) \$\endgroup\$