nvm
Newbie level 4
- Joined
- Sep 13, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 50
Hello everyone,
I have been trying to implement a 8bit checksum in vhdl.
Here is my code for that
But I keep getting these errors
I have been trying to implement a 8bit checksum in vhdl.
Here is my code for that
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 library IEEE; use IEEE.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity checksum is port ( sn : IN STD_LOGIC_VECTOR (31 DOWNTO 0); dat : IN STD_LOGIC_VECTOR (15 DOWNTO 0); sum : OUT STD_LOGIC_VECTOR (7 DOWNTO 0) ); end checksum; architecture Behavioral of checksum is -- signals signal sumwithcarry : std_logic_vector (8 downto 0); signal datapac1 : std_logic_vector(7 downto 0); signal datapac2 : std_logic_vector(7 downto 0); signal datapac3 : std_logic_vector (7 downto 0); signal datapac4 : std_logic_vector (7 downto 0); signal datapac5 : std_logic_vector (7 downto 0); signal datapac6 : std_logic_vector (7 downto 0); signal digit : std_logic; begin datapac1 <= sn(0) & sn(1) & sn(2) & sn(3) & sn(4) & sn(5) & sn(6) & sn(7); datapac2 <= sn(8) & sn(9) & sn(10) & sn(11) & sn(12) & sn(13) & sn(14) & sn(15); datapac3 <= sn(16) & sn(17) & sn(18) & sn(19) & sn(20) & sn(21) & sn(22) & sn(23); datapac4 <= sn(24) & sn(25) & sn(26) & sn(27) & sn(28) & sn(29) & sn(30) & sn(31); datapac5 <= dat(0) & dat(1) & dat(2) & dat(3) & dat(4) & dat(5) & dat(6) & dat(7); datapac6 <= dat(8) & dat(9) & dat(10) & dat(11) & dat(12) & dat(13) & dat(14) & dat(15); sumwithcarry <= "00000000" + datapac1 + datapac2 + datapac3 + datapac4 + datapac5 + datapac6; digit <= sumwithcarry(8); if (digit = '1') then --error here sumwithcarry := '0' & sumwithcarry(7 downto 0) + '1'; --error here end if; sum <= sumwithcarry(7) & sumwithcarry(6) & sumwithcarry(5) & sumwithcarry(4) & sumwithcarry(3) & sumwithcarry(2) & sumwithcarry(1) & sumwithcarry(0); end Behavioral;
But I keep getting these errors
Can someone help me fix it.Error: syntax error near if (VHDL-1261) C:\Users\orthodata\Desktop\IGLOO\ASIC PROJECT\First\hdl\checksum.vhd(55)
Error: syntax error near + (VHDL-1261) C:\Users\orthodata\Desktop\IGLOO\ASIC PROJECT\First\hdl\checksum.vhd(56)
Error: unit behavioral ignored due to previous errors (VHDL-1284) C:\Users\orthodata\Desktop\IGLOO\ASIC PROJECT\First\hdl\checksum.vhd(62)
Last edited by a moderator: