data/full_repos/permissive/20662519/tb_Servo.v
[Errno 2] No such file or directory: 'preprocess.output'
1: b'%Error: data/full_repos/permissive/20662519/tb_Servo.v:1: Cannot find include file: Servo_Rom.v\n`include "Servo_Rom.v" \n         ^~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/20662519,data/full_repos/permissive/20662519/Servo_Rom.v\n             data/full_repos/permissive/20662519,data/full_repos/permissive/20662519/Servo_Rom.v.v\n             data/full_repos/permissive/20662519,data/full_repos/permissive/20662519/Servo_Rom.v.sv\n             Servo_Rom.v\n             Servo_Rom.v.v\n             Servo_Rom.v.sv\n             obj_dir/Servo_Rom.v\n             obj_dir/Servo_Rom.v.v\n             obj_dir/Servo_Rom.v.sv\n%Error: data/full_repos/permissive/20662519/tb_Servo.v:2: Cannot find include file: Servo.v\n`include "Servo.v" \n         ^~~~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/20662519/tb_Servo.v:36: Unsupported: Ignoring delay on this delayed statement.\n    #CLK_PERIOD_NS rst = 0;\n    ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/20662519/tb_Servo.v:42: Unsupported: Ignoring delay on this delayed statement.\n    #CLK_NS clk = ~clk;    \n    ^\n%Error: Exiting due to 2 error(s), 2 warning(s)\n'
module tb_Servo #(
parameter CLK_FREQUENCY = 50000000,
parameter SPEED_MAX_PERIOD = 0.03 ,

parameter MAX_RAM_POS = 256,

parameter VALUE_SCALING = 256
);

  parameter CLK_PERIOD = 1.0 * 1/CLK_FREQUENCY;
  parameter CLK_PERIOD_NS = CLK_PERIOD * 1000000000;
  parameter CLK_NS = CLK_PERIOD_NS/2;


  parameter SPEED_MAX_VALUE =  CLK_FREQUENCY * (1/SPEED_MAX_PERIOD) * 1.0;

  parameter SPEED_LEN = log2(SPEED_MAX_VALUE);

  parameter ADDR_LEN = log2(MAX_RAM_POS);
  parameter SPEED_DATA_LEN = log2(SPEED_MAX_PERIOD * 1000);
  parameter POSITION_DATA_LEN = log2(VALUE_SCALING);
  parameter DATA_LEN = SPEED_DATA_LEN+POSITION_DATA_LEN;
  reg clk;
  reg rst;  
  wire	[ADDR_LEN-1:0]  addr;
	wire	[DATA_LEN-1:0]  rom_q;
	wire servo_q;
  
  initial begin
    clk = 0;
    rst = 1;
    #CLK_PERIOD_NS rst = 0;
  end
  
  always begin


    #CLK_NS clk = ~clk;    
  end
  
  Servo_Rom #(.ADDR_LEN(ADDR_LEN),
              .DATA_LEN(DATA_LEN))
     servoRom(.clock(clk),
              .address(addr),
              .data(rom_q));  
                        
  Servo #(.CLK_FREQUENCY(CLK_FREQUENCY), 
                    .VALUE_SCALING(VALUE_SCALING),
                    .CTR_LEN(SPEED_LEN),
                    .SPEED_DATA_LEN(SPEED_DATA_LEN),
                    .POSITION_DATA_LEN(POSITION_DATA_LEN),
                    .ADDR_LEN(ADDR_LEN),
                    .MAX_RAM_POS(MAX_RAM_POS),
                    .DATA_LEN(DATA_LEN)
                    )
                servo(.clk(clk),
                      .rst(rst),
                      .data(rom_q),
                      .address(addr),
                      .servo_q(servo_q));
 


function integer log2;
  input integer value;
  begin
    value = value-1;
    for (log2=0; value>0; log2=log2+1)
      value = value>>1;
  end
endfunction           
endmodule
module tb_Servo #(
parameter CLK_FREQUENCY = 50000000,
parameter SPEED_MAX_PERIOD = 0.03 ,

parameter MAX_RAM_POS = 256,

parameter VALUE_SCALING = 256
);


  parameter CLK_PERIOD = 1.0 * 1/CLK_FREQUENCY;
  parameter CLK_PERIOD_NS = CLK_PERIOD * 1000000000;
  parameter CLK_NS = CLK_PERIOD_NS/2;


  parameter SPEED_MAX_VALUE =  CLK_FREQUENCY * (1/SPEED_MAX_PERIOD) * 1.0;

  parameter SPEED_LEN = log2(SPEED_MAX_VALUE);

  parameter ADDR_LEN = log2(MAX_RAM_POS);
  parameter SPEED_DATA_LEN = log2(SPEED_MAX_PERIOD * 1000);
  parameter POSITION_DATA_LEN = log2(VALUE_SCALING);
  parameter DATA_LEN = SPEED_DATA_LEN+POSITION_DATA_LEN;
  reg clk;
  reg rst;  
  wire	[ADDR_LEN-1:0]  addr;
	wire	[DATA_LEN-1:0]  rom_q;
	wire servo_q;
  
  initial begin
    clk = 0;
    rst = 1;
    #CLK_PERIOD_NS rst = 0;
  end
  
  always begin


    #CLK_NS clk = ~clk;    
  end
  
  Servo_Rom #(.ADDR_LEN(ADDR_LEN),
              .DATA_LEN(DATA_LEN))
     servoRom(.clock(clk),
              .address(addr),
              .data(rom_q));  
                        
  Servo #(.CLK_FREQUENCY(CLK_FREQUENCY), 
                    .VALUE_SCALING(VALUE_SCALING),
                    .CTR_LEN(SPEED_LEN),
                    .SPEED_DATA_LEN(SPEED_DATA_LEN),
                    .POSITION_DATA_LEN(POSITION_DATA_LEN),
                    .ADDR_LEN(ADDR_LEN),
                    .MAX_RAM_POS(MAX_RAM_POS),
                    .DATA_LEN(DATA_LEN)
                    )
                servo(.clk(clk),
                      .rst(rst),
                      .data(rom_q),
                      .address(addr),
                      .servo_q(servo_q));
 


function integer log2;
  input integer value;
  begin
    value = value-1;
    for (log2=0; value>0; log2=log2+1)
      value = value>>1;
  end
endfunction           
endmodule