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

  • SEARCH
  • Home
  • 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 4622466
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:50:51+00:00 2026-05-22T02:50:51+00:00

There is no synthesis error in the following code, but still not getting the

  • 0

There is no synthesis error in the following code, but still not getting the output when I simulate it. cout is staying logic 1 all the time. Please can anybody help me out to find out whats wrong?

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity divide_by_3 is
port (
  cout   :out std_logic; -- Output clock
  clk    :in  std_logic; -- Input clock
  reset  :in  std_logic  -- Input reset
 );
end divide_by_3;

architecture Behavioral of divide_by_3 is
  signal pos_cnt :std_logic_vector (1 downto 0);
  signal neg_cnt :std_logic_vector (1 downto 0);
begin

  process (clk, reset) 
    begin
      if (reset = '1') then
        pos_cnt <= (others=>'0');
      elsif (rising_edge(clk)) then
        if (pos_cnt = "10") then
          pos_cnt <= pos_cnt + '1';
        end if;
      end if;
    end process;

    process (clk, reset) begin
      if (reset = '1') then
        neg_cnt <= (others=>'0');
      elsif (falling_edge(clk)) then
        if (neg_cnt = "10") then
          neg_cnt <= neg_cnt + '1';
        end if;
      end if;
    end process;

    cout <= '1' when ((pos_cnt /= "10") and (neg_cnt /= "10")) else
    '0';
end Behavioral;
  • 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-05-22T02:50:52+00:00Added an answer on May 22, 2026 at 2:50 am

    Your counter will never count because you do:

        if (neg_cnt = "10") then
          neg_cnt <= neg_cnt + '1';
        end if;
    

    and

        if (pos_cnt = "10") then
          pos_cnt <= pos_cnt + '1';
        end if;
    

    but both, pos_cnt and neg_cnt are reset to "00". I guess you might want to do something similar like:

        if (pos_cnt = "10") then
          pos_cnt <= (others => '0');
        else
          pos_cnt <= pos_cnt + '1';
        end if;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting a black screen whenever my app launches. There is no error
There are numerous libraries providing Linq capabilities to C# code interacting with a MySql
I keep getting this error: alt text http://img514.imageshack.us/img514/2203/help.tif What is it? I never even
I had something like the following code in a project I recently worked on.
I know the meaning of this error, but I'm really struggling with it, and
I have the following code: // ClassA.h @interface ClassA : NSObject @property (nonatomic, retain,
The following seems simple enough. There's a superclass with an ivar, and a subclass
i've been dancing with a tambourine for a while, but still don't know what's
Getting some funny bugs here. Is there anything that stands out? Specifically relating to
Can't get code to compile because of error in the - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation

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.