Forum Discussion
Altera_Forum
Honored Contributor
10 years ago --- Quote Start --- this is the code iam trying to use architecture behavioral of ADDER is -- define a temparary signal to store the result signal result: std_logic_vector(n downto 0); begin process begin -- the 9th bit should be carry WAIT UNTIL clock'EVENT AND clock = '1'; if resetn = '0'THEN result <= "000000000"; else result <= ('0' & A)+('0' & B ); end if; end process; sum <= result(n-1 downto 0); carry <= result(n); end behavioral; yhanks for advance --- Quote End --- Hi, you are quite close to solution but you need understand this is devoted to a microprocessor bus and operand A and B cannot be on bus at same time if not encoded on same mode for example in a word (deprecated without a very strong reason to do that), if you decide bus width of your device can be 8 bit then you have to declare on QSYS module and module is only able to do byte transaction. You need two addressable register to store operand then read result from adder, adder can be just conbinatorial full adder written from xor and logic if you use std logic or inferred from arithmetic. Your code instead make result from two parallel operand then store to a register on clock transition. How can you write two operand on a bus where operand are written one at time? Also you just have output from adder registered on rising edge. So inspire on example as suggested, store the two operand then read result. Try one more then post again your code or better ask again about what can be unclear. result <= ('0' & A)+('0' & B ); this expression compile error free? + is an arhitmetic operator and vector are std logic not signed or unsigned. another deprecated solution can be to have both A and B input from two conduit if you are collecting from somewhere then just read result from Avalon Again you are probably at first step on VHDL too, tell us what you wish to do with, or if this an exercise the term of it. Patience application and reading of material, documentation of quartus VHDL and QSYS too are not short so you need more and more exercise and application, just never give up.