• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. for/generate

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 64
  • Views 3442
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

for/generate

archive
archive over 18 years ago

I apologize for deleting this thread - I was attempting to fix the code issue on the first post which was skewing the formatting of the entire thread.

I learned that i cannot delete the top post in a thread without deleting all the replies.

I will attempt to regenerate the thread now.

Administrator

Initial post by alexsieh

The first code is :

module edge_detector(sign_i, // Input of the Edge Detector
rise_o, // Rising Edge Output of the Edge Detector
fall_o, // Falling Edge Output of the Edge Detector
clk, // clock
rst_b, // Synchronous Reset
);

//--------------------- Parameters Declaration ---------------------------------
parameter SIZE = 1;

//-------------------- Inputs Declaration --------------------------------------
input [SIZE-1:0]sign_i;
input clk;
input rst_b;


//---------------------- Outputs Declaration -----------------------------------
output [SIZE-1:0]rise_o;
output [SIZE-1:0]fall_o;

//------------------- Types Declaration ----------------------------------------
wire clk;
wire rst_b;
wire [SIZE-1:0]sign_i;
wire [SIZE-1:0]rise_o;
wire [SIZE-1:0]fall_o;
reg [SIZE-1:0]sign_i_syn;
reg [SIZE-1:0]out_ff2;
wire [SIZE-1:0]out_xor;

genvar i; // auxiliar variable to generate

generate for(i=0;i begin
//------------------------ Sequential Part ------------------------------------ 

always @(posedge clk)
begin
if (!rst_b)
begin

sign_i_syn[i]<=1'b0; //If reset occured clear flip flops

out_ff2<=1'b0; 

end //if(!rst) 

else 
begin 

sign_i_syn[i]<= sign_i[i]
//Transform the entering signal in synchronous 

out_ff2 [i] <= sign_i_syn[i]
//Update the second ff output value

end //else 
end //always @(posedge clk)


//-------------------------------- Combinational Part ------------------------ 

assign out_xor[i] = (sign_i_syn[i] ^ out_ff2[i]); 
// keeps the output from the xor in 1 for 1 period of clock in the rise or fall

assign rise_o[i] = (sign_i_syn[i] & out_xor[i]); 
// if the entering sinal has high level and the pulse in the xor output 
// represents a rising edge

assign fall_o[i] = ~(sign_i_syn[i] | ~out_xor[i]); 
// if the entering sinal has low level and the pulse in the xor output 
// represents a falling edge

end // for (generate) 
endgenerate


The Second:
for i in {0,1,2} generate
begin: check1
{// psl check_init: assert (!value[i]) @rose(resetn);
end
endgenerate;


The third:
for i in {0,1,2} generate
begin: check1
{//psl RISING: assert always ( rose(sign_i?]) -> next PULSE(rise_o) 
// abort !rst_b)
// report "Rising Edge Failed " severity warning;
//@fell(clk); 
end
endgenerate;


The fourth:
generate for(i=0;i begin: Rise
//psl RISING: assert always ( rose(sign_i?]) -> next PULSE(rise_o) 
// abort !rst_b)
// report "Rising Edge Failed " severity warning;
//@fell(clk); 
end
endgenerate


The sixth: probe -create -assertions -transaction -waveform -name RISING edge_detector_tb.edge_detector.Rise?].RISING Thanks and sorry about that,


Originally posted in cdnusers.org by Administrator
  • Cancel
Parents
  • archive
    archive over 18 years ago

    Hey TAM!
    Good news! After days and days in this problems, I was able to make it works!
    Your last tip was exacly what I was doing currently. The save script .svcf had two main diferences.

    1- The access to the data base was:
    #
    # Simulator
    #

    database require simulator -hints {
    simulator "ncsim -gui -cdslib /mnt/auto/titania/usuarios/tabarani/Blocos/cds.lib -logfile ncsim.log -errormax 15 -status worklib.edge_detector_tb:module -input restore.tcl"
    }

    I have changed to:

    #
    # databases
    #
    database require waves -hints {
    file ./EdgeDetector.shm/EdgeDetector.trn
    file ./EdgeDetector.shm/EdgeDetector.trn
    }

    And it was not including the probe in the .svcf script, it was only:
    set id [waveform add -signals [list simulator::edge_detector_tb.SIZE \
    simulator::edge_detector_tb.clk \
    {simulator::edge_detector_tb.fall[0:0]} \
    {simulator::edge_detector_tb.rise[0:0]} \
    simulator::edge_detector_tb.rst_b \
    {simulator::edge_detector_tb.sign_i[0:0]} ]]

    And I have changed to:
    set id [waveform add -signals [list {edge_detector_tb.clk} \
    {edge_detector_tb.fall} \
    {edge_detector_tb.rise} \
    {edge_detector_tb.rst_b} \
    {edge_detector_tb.sign_i} \
    {edge_detector_tb.edge_detector.\Rise[0] .tr_RISING} \
    {edge_detector_tb.edge_detector.\Fall[0] .tr_FALLING} \
    {edge_detector_tb.fail_probe_1} ]]


    Seens to me that the IUS5.8 is not dealing properly with this generate structure and probes, changing the script it works fine :-)

    Thanks,
    Alex Sieh

    Ps: And you are right it was tedious :)


    Originally posted in cdnusers.org by alexsieh
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 18 years ago

    Hey TAM!
    Good news! After days and days in this problems, I was able to make it works!
    Your last tip was exacly what I was doing currently. The save script .svcf had two main diferences.

    1- The access to the data base was:
    #
    # Simulator
    #

    database require simulator -hints {
    simulator "ncsim -gui -cdslib /mnt/auto/titania/usuarios/tabarani/Blocos/cds.lib -logfile ncsim.log -errormax 15 -status worklib.edge_detector_tb:module -input restore.tcl"
    }

    I have changed to:

    #
    # databases
    #
    database require waves -hints {
    file ./EdgeDetector.shm/EdgeDetector.trn
    file ./EdgeDetector.shm/EdgeDetector.trn
    }

    And it was not including the probe in the .svcf script, it was only:
    set id [waveform add -signals [list simulator::edge_detector_tb.SIZE \
    simulator::edge_detector_tb.clk \
    {simulator::edge_detector_tb.fall[0:0]} \
    {simulator::edge_detector_tb.rise[0:0]} \
    simulator::edge_detector_tb.rst_b \
    {simulator::edge_detector_tb.sign_i[0:0]} ]]

    And I have changed to:
    set id [waveform add -signals [list {edge_detector_tb.clk} \
    {edge_detector_tb.fall} \
    {edge_detector_tb.rise} \
    {edge_detector_tb.rst_b} \
    {edge_detector_tb.sign_i} \
    {edge_detector_tb.edge_detector.\Rise[0] .tr_RISING} \
    {edge_detector_tb.edge_detector.\Fall[0] .tr_FALLING} \
    {edge_detector_tb.fail_probe_1} ]]


    Seens to me that the IUS5.8 is not dealing properly with this generate structure and probes, changing the script it works fine :-)

    Thanks,
    Alex Sieh

    Ps: And you are right it was tedious :)


    Originally posted in cdnusers.org by alexsieh
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information