From 0dc0fbf78dabd596fd71e9dba838884f129fe514 Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 10 Jul 2009 18:12:09 -0700 Subject: [PATCH] Add check for prec > unit in `timescale directive. --- lexor.lex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lexor.lex b/lexor.lex index 954a2ab61..c3937fc64 100644 --- a/lexor.lex +++ b/lexor.lex @@ -1205,6 +1205,13 @@ static void process_timescale(const char*txt) return; } + /* The time unit must be greater than or equal to the precision. */ + if (unit < prec) { + VLerror(yylloc, "error: `timescale unit must not be less than " + "the precision."); + return; + } + pform_set_timescale(unit, prec, yylloc.text, yylloc.first_line); }