Coder Social home page Coder Social logo

Comments (3)

IEncinas10 avatar IEncinas10 commented on June 6, 2024

Issue is here:

static bool IsUvmMacroId(const verible::SyntaxTreeLeaf &leaf) {

From what I have seen quickly looking at this, I think the only UVM macros that are verilog_tokentype::MacroIdentifier are the ones ending in _end, so we could add that extra check:

diff --git a/verilog/analysis/checkers/uvm_macro_semicolon_rule.cc b/verilog/analysis/checkers/uvm_macro_semicolon_rule.cc
index 3e7bc9d1..3eb445d7 100644
--- a/verilog/analysis/checkers/uvm_macro_semicolon_rule.cc
+++ b/verilog/analysis/checkers/uvm_macro_semicolon_rule.cc
@@ -55,11 +55,18 @@ static std::string FormatReason(const verible::TokenInfo &macro_id) {
 
 // Returns true if leaf is a macro and matches `uvm_
 static bool IsUvmMacroId(const verible::SyntaxTreeLeaf &leaf) {
+  const absl::string_view text = leaf.get().text();
   if (leaf.Tag().tag == verilog_tokentype::MacroCallId ||
       leaf.Tag().tag == verilog_tokentype::MacroIdItem ||
       leaf.Tag().tag == verilog_tokentype::MacroIdentifier) {
-    return absl::StartsWithIgnoreCase(leaf.get().text(), "`uvm_");
+    const bool starts_with_uvm = absl::StartsWithIgnoreCase(text, "`uvm_");
+    if (leaf.Tag().tag == verilog_tokentype::MacroIdentifier) {
+      const bool ends_with_end = absl::EndsWithIgnoreCase(text, "_end");
+      return starts_with_uvm && ends_with_end;
+    }
+    return starts_with_uvm;
   }
+
   return false;
 }

I'll try and see if there is a complete list of UVM macros somewhere to make sure this hack is OK although I guess we would prefer having false negatives rather than false positives on this check.

from verible.

IEncinas10 avatar IEncinas10 commented on June 6, 2024

https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.2/html/index/Macros.html#Symbols

False positives:

  • UVM_DEFAULT_TIMEOUT
  • UVM_MAX_STREAMBITS
  • UVM_PACKER_MAX_BYTES
  • UVM_REG_ADDR_WIDTH
  • UVM_REG_DATA_WIDTH
  • UVM_REG_BYTENABLE_WIDTH
  • UVM_REG_CVR_WIDTH
  • UVM_TLM_..._MASK

So I guess my proposed change is ok.

from verible.

IEncinas10 avatar IEncinas10 commented on June 6, 2024

Let me know if you find any other false positive!

from verible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.