+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 1
    Points: 409, Level: 4

    Join Date
    Jul 2017
    Posts
    38
    Helped
    0 / 0
    Points
    409
    Level
    4

    Verilog Code: How to read count value when Trigger signal is high ?

    Hi,

    I want to read the out value with the condition when the Trigger signal (Trig_SG) is high. I have tried with below code but i didnt got proper output. Please suggest me.
    Code:
    module Trigger_RTC
    (
    input clk_50,
    //output Trig_SG,
    output reg Final_out
    );
    reg out;
    reg Trig_SG=1'b0;
    always@(posedge clk_50)
    begin
    Trig_SG<=1'b1;
    
    if(Trig_SG==1'b1)
    begin
    out<=out+1;
    Final_out<=out;
    end
    else
       Final_out<=0;
    end 
    endmodule

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 248,981, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,334
    Helped
    13171 / 13171
    Points
    248,981
    Level
    100

    Re: Verilog Code: How to read count value when Trigger signal is high ?

    What do you expect as "proper output"? According to your code, Trig_SG will be activated at the first clock edge after power on reset and stay permanently on. You should see this in a simulation.



    •   AltAdvertisment

        
       

  3. #3
    Member level 5
    Points: 595, Level: 5
    Achievements:
    Created Blog entry

    Join Date
    Apr 2018
    Location
    Gdańsk, Poland
    Posts
    90
    Helped
    18 / 18
    Points
    595
    Level
    5
    Blog Entries
    3

    Re: Verilog Code: How to read count value when Trigger signal is high ?

    Where is the source of the Trig_SG and "out value" signals? Are they from external module/pin or driven internally inside Trigger_RTC module?
    Please give us more context about the function of this block. What do you want to do and what is the vicinity?

    You want to read the "out value", but the "out value" is not an input for this module. Also Trig_SG is not an input - so it is confusing.
    To encourage me to help more, click on "Helpful Post" if you feel that I've helped you.



--[[ ]]--