-1

My goal is to produce a switch track for controlling the position_track and color_track for player1 (9-bits) and player2 (9-bits) for the board display in a VHDL-based Tic-Tac-Toe game.

Currently, I'm able to display the 3x3 grid and show the color for the switches. Only for player1 ('Blue') which is assigned to SW[9] to SW[0] in the Altera DE2 board. player2 ('Red') is not responsive in the VGA display for any of the SW[17] to SW[9].

This is for a project using VHDL with the Altera DE2 board, Cyclone II chip. In the past, I have attempted to check the syntax for entity an architecture (behavioral method) to specify the logic for tracking changes in the built-in hardware switches in the FPGA board.

Used standard libraries such as ieee.std_logic_1164.all and ieee_std.logic_unsigned.all.

FPGA

architecture behavioral of switch_track is
begin
    process
    begin
        if (player1(0) = '1') then
            position_track(0) <= 1; -- error occurs in this line (19) --
            color_track(0) <= 1;
        elsif
        -- [same logic applies for player2(0)]
        else
            position_track(0) <= 0;
            color_track(0) <= 0;
        end if;
    end process;
end architecture behavioral;

I expected that the code in the .vhd file could be synthesized correctly. However, the only error encountered in the Quartus II compiler is:

Error (10517): VHDL type mismatch error at switch_track.vhd(19): std_ulogic type does not match integer literal.

I'm not sure why std_ulogic shows up in the compiler. I'm new to VHDL and Quartus II hardware design. Constructive feedback is appreciated.

Tarick Welling
  • 3,119
  • 3
  • 19
  • 44
Saul42
  • 1
  • 3
  • 1
    Regarding `std_logic_unsigned`, see [this answer here](https://stackoverflow.com/questions/45704135/when-to-use-vhdl-library-std-logic-unsigned-and-numeric-std). It is not a standard package, it's a legacy package. You have not given the code showing what type `position_track` is, so your question is unanswerable. However, I doubt very much whether `position_track` is an array of integers, which is what it would have to be for line 19 to compile. Presumably, `position_track` is some kind of array of `std_ulogic`; in which case, the literal you want is `'1'` not `1`. – Matthew Taylor May 23 '19 at 07:48
  • 1
    please add your entity to the code so the definitions of the signals is clear. – Tarick Welling May 23 '19 at 08:21
  • Which types for position_track and color_track ? – Gautitho May 23 '19 at 08:50
  • @Matthew Taylor yes the error was due to the literal not used with the ' _ ' format to represent '1' and not 1. It was a syntax error but the VHDL code for building the 'switch_track' module to switch between player 1 (blue) and player 2 (red) should work OK now in the VGA display. – Saul42 May 23 '19 at 18:50

1 Answers1

0

The error showing up was because I did not classify 1s and 0s for position_track and color_track as '1' and '0' to properly represent the binary numbers. I did not use the right syntax.

Saul42
  • 1
  • 3