Forum Discussion
Altera_Forum
Honored Contributor
11 years agoNeed advice about coding style
Hello I'm Alex and I am novice for VHDL coding. if my english awful pls forgive me. I trying to understand VHDL PROCESS statement. I try with 1bit full adder with carry save function in Quartus2 v...
Altera_Forum
Honored Contributor
11 years agoFor your questions.
1. What you have specified is a default value if nothing is connected to it. But the value have assigned is only 4 bits long, so if N is anything other than 4, there will be an error. 2. With unsigned type, you have all the arithmetic functions, as you've already done. r <= a + b; But in your code, you have extended a by 1 bit correct, but then you also append '1' to the LSB. You need to write: result_v := ('0' & a) + ('0' & b) + ('0' & ci); -- if you get error about ambiguous types, write unsigned'('0' & ci); You also have an error in your code. result should be created as variable result_v : unsigned(N downto 0); and s should be sliced s <= result_v(N-1 downto 0); co <= result_v(N); 3. when you fix the direction errors, result_v will have a length of N+1.