2
\$\begingroup\$

I am trying to implement a fixed delay line using carry chain inside FPGA (Microchip's IGLOO2). Currently one of the constraints in this project is to use carry chain as delay elements (not any other method). I tried it using full adders: in a "for...generate" statement, when index is 0 the first carry element (full adder) is generated, and when the index is greater than 0, the next element is generated, whose carry input is the output carry of the previous element. One other condition is to make sure that synthesis does not change the components (full adders stay as I defined them). Here is my code. I am pretty sure that there are a bunch of things wrong with this code, but I am still learning vhdl and currently have no idea how to implement the delay line using carry chains.

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use ieee.numeric_std.all; entity student is generic( LENGTH : integer := 10; DATA_WIDTH : integer :=16; ); port( A : in std_logic_vector(15 downto 0); B : in std_logic_vector(15 downto 0); SUM : out std_logic_vector(15 downto 0); CIN : in std_logic; CO : out std_logic ); end entity; architecture rtl of student is signal temp : std_logic_vector(15 downto 0); signal temp1 : std_logic_vector(15 downto 0); signal temp2 : std_logic_vector(15 downto 0); signal temp3 : std_logic_vector(15 downto 0); begin abc: for i in 0 to LEGNTH-1 generate first: if i=0 generate temp1 <= '1' & A; temp2 <= '1' & B; temp <= std_logic_vector(unsigned(temp1) + unsigned(temp2)); SUM <= temp(3 downto 0); CIN <= '0'; CO <= temp(4); end generate; next: if i>0 generate temp1 <= '1' & A; temp2 <= '1' & B; temp3 <= std_logic_vector(unsigned(temp1) + unsigned(temp2)); SUM <= temp3(14 downto 0); temp3(15) <= temp(4); CIN <= temp(4); CO <= CIN; end generate; end rtl; ``` 
\$\endgroup\$
4
  • \$\begingroup\$ please format all of your code, not just parts of it \$\endgroup\$ Commented Feb 15, 2024 at 20:35
  • 1
    \$\begingroup\$ sorry, but u can still copy it through. How can I format the code? \$\endgroup\$ Commented Feb 15, 2024 at 20:42
  • 1
    \$\begingroup\$ place three ``` on a blank line before the code and also on a blank line after the code \$\endgroup\$ Commented Feb 15, 2024 at 21:02
  • 1
    \$\begingroup\$ Thanks, I didn't know that. Done! \$\endgroup\$ Commented Feb 15, 2024 at 21:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.