Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

DE115 Lab 1 part 2 Question

Altera_Forum
Honored Contributor II
1,761 Views

can not compile at x <= SW[7:0];, how to fix it? 

 

LIBRARY ieee; 

USE ieee.std_logic_1164.all; 

 

ENTITY Lab1b IS 

PORT (  

x : IN STD_LOGIC_VECTOR(7 DOWNTO 0); 

y : IN STD_LOGIC_VECTOR(15 DOWNTO 8); 

s : IN STD_LOGIC_VECTOR (1 DOWNTO 0); 

m : OUT STD_LOGIC_VECTOR (15 DOWNTO 0) 

); 

END Lab1b; 

 

ARCHITECTURE Behavior OF Lab1b IS 

BEGIN 

x <= SW[7:0]; 

y <= SW[15:8]; 

m <= (NOT (s) AND x) OR (s AND y); 

LEDR <= m; 

END Behavior;
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
556 Views

First, just look at your code. 

 

You have the ports defined using one style of vector syntax, and then the assignment to x using a different sort of syntax. Modelsim or Quartus will tell you which is wrong, as will any book on VHDL. 

 

Now, look at your code again for all the signals in the design; you have x, y, s, and m on the entity - think of this as the pins on the device - now where does SW come from? How about LEDR, where does that go to? 

 

Draw yourself a block diagram of what you want, write signal names in the block diagram, and it'll start to become clear what to do. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
556 Views
0 Kudos
Altera_Forum
Honored Contributor II
556 Views

Study Yourself instead of asking here. Or you want to fail Your exams?

0 Kudos
Reply