Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Alu

Altera_Forum
Honored Contributor II
1,364 Views

Hey all, 

 

This is my first experience with Quartus and VHDL and I am trying to make an ALU. Below is the code I have got so far.  

 

 

 

LIBRARY ieee; 

USE ieee.std_logic_1164.ALL; 

USE ieee.std_logic_signed.ALL; 

USE ieee.std_logic_arith.ALL; 

 

ENTITY alu IS 

PORT( 

a : IN STD_LOGIC_VECTOR(11 downto 0); 

opcode : IN STD_LOGIC_VECTOR(4 downto 0); 

b : IN STD_LOGIC_VECTOR(11 downto 0); 

alu_out : OUT STD_LOGIC_VECTOR(11 downto 0); 

y : BUFFER STD_LOGIC_VECTOR(11 downto 0)); 

END alu; 

 

ARCHITECTURE start OF alu IS 

BEGIN 

PROCESS (a, b, opcode,y) 

BEGIN 

CASE opcode IS 

WHEN "000--" => 

alu_out <= a ; -- Pass a 

WHEN "001--" => 

alu_out <= a + b; -- Add (a + b) 

WHEN "010--" => 

alu_out <= a - b; -- Subtract (a - b) 

WHEN "011--" => 

alu_out <= a and b; -- Logical AND (a AND b)  

WHEN "100--" => 

alu_out <= a or b; -- Logical OR (a or b)  

WHEN "101--" => 

alu_out <= a + 1; -- Increment A (a+1)  

WHEN "110--" => 

alu_out <= a - 1; -- Decrement A (a-1) 

WHEN "111--" => 

alu_out <= b; -- Pass b 

WHEN "---00" => 

y <= alu_out; -- Pass alu_out to y 

--WHEN "XXX01" => 

-- y <= ; --  

--WHEN "XXX10" => 

-- y <= ; --  

WHEN "XXX11" => 

y <= ("000000000000"); -- Pass 0's to y 

WHEN others => 

y <= (others => '0'); 

END CASE; 

END PROCESS; 

END start; 

 

 

 

 

 

I get warnings including: 

 

Warning (10325): VHDL Choice warning at alu.vhd(21): ignored choice containing meta-value ""000--"" 

 

Warning (10034): Output port "alu_out[11]" at alu.vhd(12) has no driver 

 

Warning: Output pins are stuck at VCC or GND 

Warning (13410): Pin "alu_out[0]" is stuck at GND 

Warning (13410): Pin "alu_out[1]" is stuck at GND 

Warning (13410): Pin "alu_out[2]" is stuck at GND 

Warning (13410): Pin "alu_out[3]" is stuck at GND 

Warning (13410): Pin "alu_out[4]" is stuck at GND 

Warning (13410): Pin "alu_out[5]" is stuck at GND 

Warning (13410): Pin "alu_out[6]" is stuck at GND 

Warning (13410): Pin "alu_out[7]" is stuck at GND 

Warning (13410): Pin "alu_out[8]" is stuck at GND 

Warning (13410): Pin "alu_out[9]" is stuck at GND 

Warning (13410): Pin "alu_out[10]" is stuck at GND 

Warning (13410): Pin "alu_out[11]" is stuck at GND 

Warning (13410): Pin "y[0]" is stuck at GND 

Warning (13410): Pin "y[1]" is stuck at GND 

Warning (13410): Pin "y[2]" is stuck at GND 

Warning (13410): Pin "y[3]" is stuck at GND 

Warning (13410): Pin "y[4]" is stuck at GND 

Warning (13410): Pin "y[5]" is stuck at GND 

Warning (13410): Pin "y[6]" is stuck at GND 

Warning (13410): Pin "y[7]" is stuck at GND 

Warning (13410): Pin "y[8]" is stuck at GND 

Warning (13410): Pin "y[9]" is stuck at GND 

Warning (13410): Pin "y[10]" is stuck at GND 

Warning (13410): Pin "y[11]" is stuck at GND 

 

Warning: Design contains 29 input pin(s) that do not drive logic 

Warning (15610): No output dependent on input pin "a[0]" 

Warning (15610): No output dependent on input pin "a[1]" 

Warning (15610): No output dependent on input pin "a[2]" 

Warning (15610): No output dependent on input pin "a[3]" 

Warning (15610): No output dependent on input pin "a[4]" 

Warning (15610): No output dependent on input pin "a[5]" 

Warning (15610): No output dependent on input pin "a[6]" 

Warning (15610): No output dependent on input pin "a[7]" 

Warning (15610): No output dependent on input pin "a[8]" 

Warning (15610): No output dependent on input pin "a[9]" 

Warning (15610): No output dependent on input pin "a[10]" 

Warning (15610): No output dependent on input pin "a[11]" 

Warning (15610): No output dependent on input pin "opcode[0]" 

Warning (15610): No output dependent on input pin "opcode[1]" 

Warning (15610): No output dependent on input pin "opcode[2]" 

Warning (15610): No output dependent on input pin "opcode[3]" 

Warning (15610): No output dependent on input pin "opcode[4]" 

Warning (15610): No output dependent on input pin "b[0]" 

Warning (15610): No output dependent on input pin "b[1]" 

Warning (15610): No output dependent on input pin "b[2]" 

Warning (15610): No output dependent on input pin "b[3]" 

Warning (15610): No output dependent on input pin "b[4]" 

Warning (15610): No output dependent on input pin "b[5]" 

Warning (15610): No output dependent on input pin "b[6]" 

Warning (15610): No output dependent on input pin "b[7]" 

Warning (15610): No output dependent on input pin "b[8]" 

Warning (15610): No output dependent on input pin "b[9]" 

Warning (15610): No output dependent on input pin "b[10]" 

Warning (15610): No output dependent on input pin "b[11]" 

 

 

I think it is to do with using the "-" for dont care in the when statement. Can anybody please help??
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
680 Views

Am I all alone on this then? :-( 

 

Any help would be greatly appreciated!! Please!
0 Kudos
Altera_Forum
Honored Contributor II
680 Views

No you are not alone. 

 

1) don't use buffer port at all. I am not sure what y output is for. 

2) use clock in your design(clock your process). This is not essential right now but will be soon in your project 

3) use one case statement for each output; one for alu_out and one for the mystery y output. You can't read alu_out(as you are assigning alu_out to y), I don't know how your compiler didn't issue an error. 

 

4) split up your opcode into 3 bits and 2 bits(assuming you need them separately) one case for opcode(4 downto 2): 

case opcode(4 downto 2) is 

when "000" etc. 

 

do not use (- or x) 

 

for y output use a separate case: 

case opcode(1 dwnto 0) is 

when "00" .etc 

 

Hope this helps
0 Kudos
Reply