@@ -127,7 +127,8 @@ struct CreateClockCmd : public Pass {
127127 float falling_edge (0 );
128128 float period (0 );
129129 if (args.size () < 4 ) {
130- log_cmd_error (" Incorrect number of arguments\n " );
130+ log_file_error (__FILE__, __LINE__, " %s: Found only %ld arguments, but a minimum of 3 are required.\n " , pass_name.c_str (),
131+ args.size () - 1 );
131132 }
132133 for (argidx = 1 ; argidx < args.size (); argidx++) {
133134 std::string arg = args[argidx];
@@ -149,8 +150,16 @@ struct CreateClockCmd : public Pass {
149150 }
150151 break ;
151152 }
153+ if (argidx == args.size ()) {
154+ log_file_error (__FILE__, __LINE__, " %s: No target signal was provided.\n " , pass_name.c_str ());
155+ }
152156 if (period <= 0 ) {
153- log_cmd_error (" Incorrect period value\n " );
157+ log_file_error (__FILE__, __LINE__, " %s: Found non-positive period value of %f, periods must be positive and greater than zero.\n " ,
158+ pass_name.c_str (), period);
159+ }
160+ if (!is_waveform_specified) {
161+ rising_edge = 0 ;
162+ falling_edge = period / 2 ;
154163 }
155164 // Add "w:" prefix to selection arguments to enforce wire object
156165 // selection
@@ -177,10 +186,6 @@ struct CreateClockCmd : public Pass {
177186 if (name.empty ()) {
178187 name = RTLIL::unescape_id (selected_wires.at (0 )->name );
179188 }
180- if (!is_waveform_specified) {
181- rising_edge = 0 ;
182- falling_edge = period / 2 ;
183- }
184189 Clock::Add (name, selected_wires, period, rising_edge, falling_edge, Clock::EXPLICIT);
185190 }
186191
0 commit comments