• 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. High-Level Synthesis
  3. CTOS setting default external delays for input and outp...

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 23
  • Views 15546
  • 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

CTOS setting default external delays for input and outputs

Matt Hutson
Matt Hutson over 10 years ago

Hi,

  as C to Silicon external delay and working out all_inputs/outputs was not very clear I have put together a tcl script to set a default value for all.

35% on external on inputs & 75% on outputs relies on $clk_period for the moment.

Just thought I would post as search did not find much and might be useful for others.

Obviously lots of improvements could be done by making it a procedure, etc.

#### setup default external delays on ins & outs but not clocks

# setup delays in ps
set flop_delay_value 500
set input_delay_value  [ expr $clk_period * 35 / 100 ]
set output_delay_value [ expr $clk_period * 75 / 100 ]
#set input_delay_value  [ expr {max ($input_delay_value,  $flop_delay_value)}]
# max equivalent
if { [expr $input_delay_value < $flop_delay_value ]} {
  set input_delay_value $flop_delay_value
}
#set output_delay_value [ expr {max ($output_delay_value, $flop_delay_value)}]
# max equivalent
if { [expr $output_delay_value < $flop_delay_value ]} {
  set output_delay_value $flop_delay_value
}

# get all the terminals on the top module
# need
set toppy [get_design]/modules/[get_attr top_module_path [get_design]]
set terms [find -root $toppy -module_term *]
# set input delay on all inputs but not on clock not sure about reset
# set output delay on all outputs but not clock
foreach term $terms {
  if {[get_attr is_clock $term]} {
    continue
  }
  set t_direction [get_attr direction $term]
  if {$t_direction == "in"} {
    #puts "$term : $t_direction : should be in"
    external_delay -input $input_delay_value -clock clk -edge rise $term
    # could do a match for reset maybe
    #set inputDelay [get_attr input_delay $term]
    #puts "Input term: $term exhibits an input delay of: $inputDelay ps"
  } elseif {$t_direction == "out"} {
    #puts "$term : $t_direction : should be out"
    external_delay -output $output_delay_value -clock clk -edge rise $term
    #set outputDelay [get_attr output_delay $term]
    #puts "Output term: $term exhibits an input delay of: $outputDelay ps"
  } else {
    puts "terminal without direction $term [get_attr direction $term]"
  }
}

  • Cancel
Parents
  • dpursley
    dpursley over 10 years ago

    Hi, Matt,

    Thanks for posting this. That is a nice common utility function, so hopefully other C-to-Silicon Compiler users find it useful as well.

    Thank you!

    You might be interested to know that Stratus HLS provides a few different approaches to do this. The most common usage is as follows.

    set_attr default_input_delay $input_delay_value

    That attributes automatically set the input delays for all inputs, relative to the clock. (The clock is port is automatically excluded.)

    There is a similar command for outputs... just substitute "output" for "input" above and in the examples below.

    Stratus HLS supports multiple synthesis scenarios (a.k.a.configurations) in one project, meaning that there can be multiple implementations (with different synthesis options) for a given design. Often, the default input and output delays is the same for all scenarios, so the above still is the best practice.

    But if you want to explicitly set default input and output delays for each configuration, you can do the following.

    define_hls_config dut C1 --default_input_delay=$input_delay_value

    or equivalently

    define_hls_config dut C1
    set_attr default_input_delay $input_delay_value [find -hls_config C1]

    Many attributes in Stratus HLS can also be set directly in your SystemC code, if you prefer that type of interface.

    HLS_SET_INPUT_DELAY (0.5);

    If that command (or directive) is in the module constructor, the specified delay will apply to all inputs of the module. If placed at the beginning of an SC_CTHREAD or SC_METHOD, then it apply just to that process.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • dpursley
    dpursley over 10 years ago

    Hi, Matt,

    Thanks for posting this. That is a nice common utility function, so hopefully other C-to-Silicon Compiler users find it useful as well.

    Thank you!

    You might be interested to know that Stratus HLS provides a few different approaches to do this. The most common usage is as follows.

    set_attr default_input_delay $input_delay_value

    That attributes automatically set the input delays for all inputs, relative to the clock. (The clock is port is automatically excluded.)

    There is a similar command for outputs... just substitute "output" for "input" above and in the examples below.

    Stratus HLS supports multiple synthesis scenarios (a.k.a.configurations) in one project, meaning that there can be multiple implementations (with different synthesis options) for a given design. Often, the default input and output delays is the same for all scenarios, so the above still is the best practice.

    But if you want to explicitly set default input and output delays for each configuration, you can do the following.

    define_hls_config dut C1 --default_input_delay=$input_delay_value

    or equivalently

    define_hls_config dut C1
    set_attr default_input_delay $input_delay_value [find -hls_config C1]

    Many attributes in Stratus HLS can also be set directly in your SystemC code, if you prefer that type of interface.

    HLS_SET_INPUT_DELAY (0.5);

    If that command (or directive) is in the module constructor, the specified delay will apply to all inputs of the module. If placed at the beginning of an SC_CTHREAD or SC_METHOD, then it apply just to that process.

    • 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