Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:27:33+00:00 2026-06-04T04:27:33+00:00

First there is this simple adder entity: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use ieee.std_logic_unsigned.all; use

  • 0

First there is this simple adder entity:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_misc.all;
use ieee.numeric_std.all;

entity adder is
    Port ( a : in  STD_LOGIC_VECTOR(31 downto 0);
           b : in  STD_LOGIC_VECTOR(31 downto 0);
           alu_out : out  STD_LOGIC_VECTOR(31 downto 0) := (others => '0')
           );
end adder;

architecture Behavioral of adder is
  signal result_ext:STD_LOGIC_VECTOR(32 downto 0) := (others => '0');
  signal result:STD_LOGIC_VECTOR(31 downto 0)     := (others => '0');
begin

  process (a,b)
  begin
    result_ext <= std_logic_vector(signed('0' & a) + signed('0' & b));
    result     <= result_ext(result'left downto 0);

    alu_out <= result;
  end process;
end Behavioral;

And test bench:

-- TestBench Template 

  LIBRARY ieee;
  USE ieee.std_logic_1164.ALL;
  USE ieee.numeric_std.ALL;

  ENTITY testbench IS
  END testbench;

  ARCHITECTURE behavior OF testbench IS         

    signal a : STD_LOGIC_VECTOR(31 downto 0);
    signal b : STD_LOGIC_VECTOR(31 downto 0);
    signal alu_out : STD_LOGIC_VECTOR(31 downto 0);
  BEGIN
    ADDER : entity work.adder port map(
      a => a,
      b => b,
      alu_out => alu_out
    );



  --  Test Bench Statements
     tb : PROCESS
     BEGIN

        a <= B"0000_0000_0000_0000_0000_0000_0111_1010";
        b <= B"0000_0000_0000_0000_0000_0000_0000_1011";

        wait for 100 ns; -- wait until global set/reset completes

        report "alu_out = " & integer'image(to_integer(signed(alu_out)));

        wait; -- will wait forever
     END PROCESS tb;
  --  End Test Bench 

  END;

I get report output:

Finished circuit initialization process.
at 100 ns: Note: alu_out = 0 (/testbench/).

If I don’t initialize result signal I get Undefined. So problem is that I don’t get
result in the end.

I use iSim and Xilinx.

Also if someone have some good links to some short and effective material on VHDL, feel free to post it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:27:34+00:00Added an answer on June 4, 2026 at 4:27 am

    The issue is that you are using signals for result and result_ext when you wanted their immediate value for that cycle of the process. Variables update immediately and you can access their values in the current cycle of the process.

    Try this out, I think it fixes the problem you are having:

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use ieee.std_logic_unsigned.all;
    use ieee.numeric_std.all;
    
    entity adder is
        Port ( a : in  STD_LOGIC_VECTOR(31 downto 0);
               b : in  STD_LOGIC_VECTOR(31 downto 0);
               alu_out : out  STD_LOGIC_VECTOR(31 downto 0) := (others => '0')
               );
    end adder;
    
    architecture Behavioral of adder is
    
    
    begin
    
      process (a,b)
        variable result_ext:STD_LOGIC_VECTOR(32 downto 0) := (others => '0');
        variable result:STD_LOGIC_VECTOR(31 downto 0);
      begin
        result_ext := std_logic_vector(signed('0' & a) + signed('0' & b));
        result     := result_ext(result'left downto 0);
    
        alu_out <= result;
      end process;
    end Behavioral;
    

    As for reading material, the VHDL cookbook is not bad: VHDL Cookbook

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I'm sure there must be a simple solution to this but
In Concrete Abstractions , there is this example of recursion: (define subtract-the-first (lambda (n)
First, I noticed there are many questions regarding this, lots marked as duplicate. I
First of, I know there are similar questions already on stackoverflow ( this ,
I know there exists a command like jQuery.noConflict. But for this it first registers
Is there any way to first test if a file is in use before
First of all: I do know that there are already many questions and answers
First of all, there are many cases where Sleep() is misused , for example
When using the CTP 5 of Entity Framework code-first library (as announced here )
i know this sounds simple for some people out there. i also tried this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.