<commit_before>
proc add_pwm {module_name clk offset pwm_width num_ports} {

  set bd [current_bd_instance .]
  current_bd_instance [create_bd_cell -type hier $module_name]

  create_bd_pin -dir I clk
  
  for {set i 0} {$i < $num_ports} {incr i} {
    create_bd_pin -dir I -from 31 -to 0 pwm$i
  }

  create_bd_pin -dir I -from 1023 -to 0 cfg

  connect_bd_net [get_bd_pins clk] [get_bd_pins /$clk]

  cell xilinx.com:ip:xlconcat:2.1 concat_pwm [list NUM_PORTS $num_ports] {}
  connect_bd_net [get_bd_ports /dac_pwm_o] [get_bd_pins concat_pwm/dout]

  for {set i 0} {$i < $num_ports} {incr i} {
    cell koheron:user:pwm:1.0 pwm_$i \
      [list NBITS $pwm_width] \
      [list clk clk rst /${::rst_name}/peripheral_reset pwm_out concat_pwm/In$i]
    cell xilinx.com:ip:xlslice:1.0 pwm_slice_$i \
      [list DIN_WIDTH 32 DIN_FROM [expr $pwm_width-1] DIN_TO 0] \
      [list Din pwm$i Dout pwm_$i/threshold]
  }

  current_bd_instance $bd

}<commit_msg>Update pwm.tcl<commit_after>
proc add_pwm {module_name clk offset pwm_width num_ports} {

  set bd [current_bd_instance .]
  current_bd_instance [create_bd_cell -type hier $module_name]

  create_bd_pin -dir I clk
  create_bd_pin -dir I rst
  
  for {set i 0} {$i < $num_ports} {incr i} {
    create_bd_pin -dir I -from 31 -to 0 pwm$i
  }

  connect_bd_net [get_bd_pins clk] [get_bd_pins /$clk]

  cell xilinx.com:ip:xlconcat:2.1 concat_pwm [list NUM_PORTS $num_ports] {}
  connect_bd_net [get_bd_ports /dac_pwm_o] [get_bd_pins concat_pwm/dout]

  for {set i 0} {$i < $num_ports} {incr i} {
    cell koheron:user:pwm:1.0 pwm_$i {
      NBITS $pwm_width
    } {
      clk clk
      rst rst
      pwm_out concat_pwm/In$i
    }
    cell xilinx.com:ip:xlslice:1.0 pwm_slice_$i {
      DIN_WIDTH 32
      DIN_FROM [expr $pwm_width-1]
      DIN_TO 0
    } {
      Din pwm$i
      Dout pwm_$i/threshold
    }
  }

  current_bd_instance $bd

}
{'fraction_non_alphanumeric': 0.1069348861831657, 'fraction_numerical': 0.018528321863419798, 'mean_word_length': 3.1629955947136565, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3068366', 'n_tokens_mistral': 870, 'n_tokens_neox': 825, 'n_words': 191}