       (when (executable-find "ag")
         (require 'ag)
         (require 'projectile)
-        (defvar verilog-identifier-regexp "[a-zA-Z][a-zA-Z0-9_]*"
+
+        (defvar verilog-mode-identifier-regexp "[a-zA-Z][a-zA-Z0-9_]*"
           "Regexp for a valid verilog identifier.")
+
+        ;; Regexp for reserved verilog keywords which should not be incorrectly
+        ;; parsed as a module or instance name
+        (setq verilog-mode-reserved-regexp nil)
+        (let ((cnt 1)
+              ;; `verilog-keywords' list is defined in the `verilog-mode.el'
+              (max-cnt (safe-length verilog-keywords)))
+          (dolist (keyword verilog-keywords)
+            (cond
+              ((= cnt 1)       (setq verilog-mode-reserved-regexp (concat "\\(" keyword)))
+              ((= cnt max-cnt) (setq verilog-mode-reserved-regexp (concat verilog-mode-reserved-regexp  "\\|" keyword "\\)")))
+              (t               (setq verilog-mode-reserved-regexp (concat verilog-mode-reserved-regexp  "\\|" keyword))))
+            (setq cnt (1+ cnt))))
 
         (defun verilog-mode-find-parent-module ()
           "Find the places where the current verilog module is instantiated in

;; Time-stamp: <2015-03-11 14:13:53 kmodi>

;; Verilog


                          ;; (message "---- 3 ---- %s" (match-string 3))
                          ;; (message "---- 4 ---- %s" (match-string 4))
                          ;; (message "---- 5 ---- %s" (match-string 5))
                          (setq-local verilog-mode-module-name   (match-string 1))
                          (setq-local verilog-mode-instance-name (match-string 4))

                          (when (and (stringp verilog-mode-module-name)
                                     (string-match verilog-mode-reserved-regexp
                                                   verilog-mode-module-name))
                            (setq-local verilog-mode-module-name nil))

                          (when (and (stringp verilog-mode-instance-name)
                                     (string-match verilog-mode-reserved-regexp
                                                   verilog-mode-instance-name))
                            (setq-local verilog-mode-instance-name nil))

                          (if (or (null verilog-mode-module-name)
                                  (null verilog-mode-instance-name))
                              nil
                            (concat verilog-mode-module-name
                                    "|" verilog-mode-instance-name)))
                      nil))))))

        (defun verilog-mode-jump-to-module-at-point ()
