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 7247817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:03:24+00:00 2026-05-28T22:03:24+00:00

I have a little problem with following VHDL code: process (zbroji) begin if rising_edge(zbroji)

  • 0

I have a little problem with following VHDL code:

process (zbroji)
begin
    if rising_edge(zbroji) then
        oduzima <= '0';
        ucitanPrvi <= '1';
        broj1 <= ulaz_broj;
    end if;
end process;

process (oduzmi)
begin
    if rising_edge(oduzmi) then
        oduzima <= '1';
        ucitanPrvi <= '1';
        broj1 <= ulaz_broj;
    end if;

end process;

The problem is that signal ucitanPrvi always has value X. If I don’t try to set it’s value in two processes, then I don’t have any problems … So I know that I mustn’t drive one signal from multiple processes, but I don’t know how to write this differently …
Does anyone have an idea how I could resolve this problem ?

Thanks !

EDIT: Thank you all guys for replying 🙂 Now I understand why I can’t drive one signal from multiple processes (at least in the way I wanted it to work).

  • 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-28T22:03:25+00:00Added an answer on May 28, 2026 at 10:03 pm

    If you want to synthesize your design for a real FPGA or ASIC, you are going to have to think of VHDL in terms of real hardware (wires, flip flops, gates, etc.). Also, if you want to perform a real rising edge detect in hardware, you will need a system clock that drives a flip flop. Given your original code sample, it doesn’t seem that zbroji or oduzmi are system clocks, but just std_logic signals. I wrote this code example assuming basic functionality from your example, hopefully, you can take my code and comments and accomplish what you need.

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;
    
    entity example is
      port (Reset      : in  std_logic;
            SysClk     : in  std_logic;
            zbroji     : in  std_logic;
            oduzmi     : in  std_logic;
            ulaz_broj  : in  std_logic;
            oduzima    : out std_logic;
            ucitanPrvi : out std_logic;
            broj1      : out std_logic
            );
    
    end example;
    
    architecture Behavioral of example is
    
      -- Delayed version of input signals (1 clock cycle delay)
      signal zbroji_d : std_logic;
      signal oduzmi_d : std_logic;
    
      signal zbrojiRE : std_logic;
      signal oduzmiRE : std_logic;
    
    begin
    
      -- Generate 1 clock cycle delayed version of
      -- signals we want to detect the rising edge
      -- Assumes active high reset
      -- Note: You should only use the rising_edge macro
      -- on an actual global or regional clock signal. FPGA's and
      -- ASICs place timing constraints on defined clock signals
      -- that make it possible to use rising_edge, otherwise, we have
      -- to generate our own rising edge signals by comparing delayed
      -- versions of a signal with the current signal.
      -- Also, with any respectable synthesizer / simulator using
      -- rising_edge is almos exactly the same as (clk'event and clk='1')
      -- except rising_edge only returns a '1' when the clock makes a
      -- valid '0' to '1' transition. (see link below)
      EdgeDetectProc : process (Reset, SysClk)
      begin
        if Reset = '1' then
          zbroji_d <= '0';
          oduzmi_d <= '0';
        elsif rising_edge(SysClk) then
          zbroji_d <= zbroji;
          oduzmi_d <= oduzmi;
        end if;
      end process EdgeDetectProc;
    
      -- Assert risinge edge signals for one clock cycle 
      zbrojiRE <= '1' when zbroji = '1' and zbroji_d = '0' else '0';
      oduzmiRE <= '1' when oduzmi = '1' and oduzmi_d = '0' else '0';
    
      -- Assumes that you want a single cycle pulse on ucitanPrvi on the
      -- rising edege of zbroji or oduzmi;
      ucitanPrvi <= zbrojiRE or oduzmiRE;
    
      -- Based on your example, I can't tell what you want to do with the
      -- broj1 signal, but this logic will drive broj1 with ulaz_broj on
      -- either the zbroji or oduzmi rising edge, otherwise '0'.
      broj1 <= ulaz_broj when zbrojiRE = '1' else
               ulaz_broj when oduzmiRE = '1' else
               '0';
    
      -- Finally, it looks like you want to clear oduzima on the rising
      -- edge of zbroji and assert oduzima on the rising edge of
      -- oduzmi
      LatchProc : process (Reset, SysClk)
      begin
        if Reset = '1' then
          oduzima <= '0';
        elsif rising_edge(SysClk) then
          if zbrojiRE = '1' then
            oduzima <= '0';
          elsif oduzmiRE = '1' then
            oduzima <= '1';
          end if;
        end if;
      end process LatchProc;
    
    end Behavioral;
    

    The previous code assumes you have a system clock. In a simulator like ModelSim (free student edition), you can generate a 100 MHz clock with non-synthesizable testbench code like this…

    ClockProc : process
    begin 
       SysClk <= '0';
       wait for 5 ns;
       SysClk <= '1';
       wait for 5 ns;
    end process ClockProc;
    

    In an actual FPGA/ASIC implementation, you will probably want to use an external oscillator that you run into your chip, drive the signal into a DCM (Digital clock manager), which will output a very clean clock signal to all of your VHDL logic, so you can have a glitch free design.

    And finally, here is a great explanation on the differences between rising_edge and
    (clk’event and clk=’1′)

    http://vhdlguru.blogspot.com/2010/04/difference-between-risingedgeclk-and.html

    Hope that helps.

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

Sidebar

Related Questions

I have run into a rather weird little problem. In the following code I
Hello i'm practising C and i have a little problem with the following code.
I have a little problem with the following code. When I click Send it
I am little bit confused about following problem & their solutions: i have 2
I have a little problem. This is my code: stackPanelShapesContainer = new StackPanel(); InitializeStackPanle();
i have a little problem with my java socket code. I'm writing an android
I have a little problem, have the following statement in mysql: SELECT cmfilm.*, cmgenre.titel
I'm having a little problem here! I have discovered the following as being the
I'm having a little problem with the css display property. I have the following
I have a little problem in coding in OO way. Here is my code:

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.