@@ -122,6 +122,7 @@ def _check_ck_paths_against_fc_doc(
122122 )
123123 return errors
124124
125+ un_find_path_list = []
125126 for ck_path in ck_klist :
126127 if ck_path not in fc_ck_paths :
127128 parts = ck_path .split ("/" )
@@ -134,6 +135,9 @@ def _check_ck_paths_against_fc_doc(
134135 f"Add this tag hierarchy to '{ fc_doc_name } ' first, or fix the tag name "
135136 f"in the static bug doc to match an existing entry."
136137 )
138+ un_find_path_list .append (ck_path )
139+ if len (un_find_path_list ) > 0 :
140+ errors .append ({f"Available CK tags in { fc_doc_name } " : ck_klist })
137141 return errors
138142
139143
@@ -191,7 +195,7 @@ def __init__(self, static_doc: str, functions_and_checks_doc: str, **kw):
191195 self .static_doc = static_doc
192196 self .functions_and_checks_doc = functions_and_checks_doc
193197
194- def do_check (self , timeout = 0 , ** kw ) -> Tuple [bool , object ]:
198+ def do_check (self , timeout = 0 , empty_is_ok = False , ** kw ) -> Tuple [bool , object ]:
195199 """Validate static bug tag format and mandatory LINK-BUG/FILE child tags."""
196200 real_path = self .get_path (self .static_doc )
197201 if not os .path .exists (real_path ):
@@ -225,6 +229,8 @@ def do_check(self, timeout=0, **kw) -> Tuple[bool, object]:
225229
226230 # ── no BG-STATIC tags at all ──────────────────────────────────────────
227231 if not klist and not blist :
232+ if empty_is_ok :
233+ return True , {"message" : "No static bugs recorded." }
228234 return False , {
229235 "error" : (
230236 f"No <BG-STATIC-*> tags found in '{ self .static_doc } '. "
@@ -612,7 +618,8 @@ def __init__(self, static_doc: str, functions_and_checks_doc: str,
612618 self .functions_and_checks_doc = functions_and_checks_doc
613619 self .file_list = file_list if isinstance (file_list , list ) else [file_list ]
614620 self .batch_size = batch_size
615- self .batch_task = UnityChipBatchTask ("source_files" , self )
621+ self .batch_task = UnityChipBatchTask ("RTL_file_to_analyze" , self )
622+ self .fmt_checker = UnityChipCheckerStaticBugFormat (self .static_doc , self .functions_and_checks_doc )
616623
617624 # ── internal helpers ─────────────────────────────────────────────────────
618625
@@ -734,6 +741,7 @@ def _handle_no_source_files(self) -> Tuple[bool, object]:
734741 def on_init (self ):
735742 """Populate batch state from the static doc so that get_template_data()
736743 returns correct values when called by the framework before do_check()."""
744+ self .fmt_checker .set_workspace (self .workspace )
737745 self ._init_batch_state ()
738746 return super ().on_init ()
739747
@@ -765,116 +773,14 @@ def do_check(self, is_complete: bool = False, **kw) -> Tuple[bool, object]:
765773 self .batch_task .sync_gen_task (
766774 gen , note_msg , "Analyzed files updated from document."
767775 )
768-
769- total = len (self .batch_task .source_task_list )
770- analyzed_count = len (self .batch_task .gen_task_list )
771-
772776 passed , result = self .batch_task .do_complete (
773777 note_msg , is_complete ,
774778 f"in source file patterns { self .file_list } " ,
775779 f"in { self .static_doc } <file> progress tags" ,
776- " Refer to the 'task' field for detailed analysis steps ." ,
780+ " Please use tool `CurrentFileTips` to get detailed task description ." ,
777781 )
778-
779- # ── All files analyzed — run format validation ────────────────────────
780- if passed :
781- fmt_checker = UnityChipCheckerStaticBugFormat (
782- self .static_doc , self .functions_and_checks_doc
783- )
784- fmt_checker .set_workspace (self .workspace )
785- fmt_passed , fmt_result = fmt_checker .do_check (** kw )
786- if fmt_passed and isinstance (fmt_result , dict ):
787- fmt_result ["analysis_progress" ] = f"{ analyzed_count } /{ total } "
788- fmt_result ["analyzed_files" ] = self .batch_task .gen_task_list
782+ kw ["empty_is_ok" ] = not passed
783+ fmt_passed , fmt_result = self .fmt_checker .do_check (** kw )
784+ if not fmt_passed :
789785 return fmt_passed , fmt_result
790-
791- # ── Files remaining — enrich result with analysis task details ────────
792- current_batch = self .batch_task .tbd_task_list
793- remaining = total - analyzed_count
794-
795- if isinstance (result , dict ) and current_batch :
796- result ["task" ] = [
797- f"Perform static bug analysis on the following { len (current_batch )} source file(s) "
798- f"and record any findings in { self .static_doc } :" ,
799- * [f" - { f } " for f in current_batch ],
800- "" ,
801- "Analysis steps:" ,
802- " 1. Read the source file(s) and understand the module structure and data flow." ,
803- " 2. Cross-reference each <CK-*> check-point in functions_and_checks.md against the RTL implementation." ,
804- " 3. Systematically check: FSM completeness, arithmetic overflow, reset/clock logic, interface protocols, control paths." ,
805- " 4. Record findings in the static bug analysis document using the STRICT tag hierarchy below." ,
806- " 5. If no bugs are found for a check-point, add <BG-STATIC-000-NULL> under the corresponding <CK-*>." ,
807- " 6. For high/medium confidence bugs, add new <CK-*> check-points to functions_and_checks.md." ,
808- "" ,
809- f"=== SOURCE OF <FG-*>/<FC-*>/<CK-*> TAGS (important) ===" ,
810- f" All <FG-*>, <FC-*>, and <CK-*> tags used in { self .static_doc } " ,
811- f" MUST come from { self .functions_and_checks_doc } — do NOT invent new ones." ,
812- " Workflow:" ,
813- f" a) Check { self .functions_and_checks_doc } first to see if the target <FG-*>/<FC-*>/<CK-*> exists." ,
814- f" b) If it exists: use it as-is in { self .static_doc } (case-sensitive, exact match)." ,
815- " c) If it does NOT exist (e.g. you found a defect not covered by any check-point):" ,
816- f" First add the new <FG-*>/<FC-*>/<CK-*> entry to { self .functions_and_checks_doc } ," ,
817- f" then record the bug under that tag in { self .static_doc } ." ,
818- "" ,
819- "=== TAG HIERARCHY (mandatory — must not deviate) ===" ,
820- " <FG-*> functional group (e.g. <FG-ARITHMETIC>) ← from functions_and_checks.md" ,
821- " └─ <FC-*> sub-feature (e.g. <FC-ADD>) ← from functions_and_checks.md" ,
822- " └─ <CK-*> check-point (e.g. <CK-OVERFLOW>) ← from functions_and_checks.md (add if missing)" ,
823- " └─ <BG-STATIC-NNN-NAME> bug entry (e.g. <BG-STATIC-001-ADD-OVERFLOW>)" ,
824- " └─ <LINK-BUG-[BG-TBD]> exactly one, marks bug as pending" ,
825- " └─ <FILE-path:L1-L2> one or more, source location" ,
826- "" ,
827- "=== EXAMPLE — bug found ===" ,
828- " <FG-ALU>" ,
829- " #### Addition <FC-ADD>" ,
830- " - <CK-OVERFLOW> Overflow flag not asserted on carry-out <BG-STATIC-001-ADD-OVERFLOW>" ,
831- " - <LINK-BUG-[BG-TBD]>" ,
832- " - <FILE-rtl/alu.v:25-30>" ,
833- " ```verilog" ,
834- " // rtl/alu.v lines 25-30" ,
835- " 25: assign overflow = carry; // BUG: missing cin contribution" ,
836- " ```" ,
837- " - <FILE-rtl/alu.v:42-44>" ,
838- " ```verilog" ,
839- " // rtl/alu.v lines 42-44" ,
840- " 42: assign sum = a + b; // BUG: cin ignored" ,
841- " ```" ,
842- "" ,
843- "=== EXAMPLE — no bug found ===" ,
844- " <FG-ALU>" ,
845- " #### Subtraction <FC-SUB>" ,
846- " - <CK-BORROW> Borrow signal correct <BG-STATIC-000-NULL>" ,
847- " (NOTE: <BG-STATIC-000-NULL> must have NO <LINK-BUG-*> or <FILE-*> child tags)" ,
848- "" ,
849- "=== CRITICAL RULES ===" ,
850- f" - [SOURCE] All <FG-*>/<FC-*>/<CK-*> MUST originate from { self .functions_and_checks_doc } ." ,
851- f" If a required tag is absent, add it to { self .functions_and_checks_doc } first, then use it here." ,
852- " - Every <BG-STATIC-*> (except NULL) needs EXACTLY ONE <LINK-BUG-[BG-TBD]> child." ,
853- " - Every <LINK-BUG-[BG-TBD]> needs AT LEAST ONE <FILE-path:L1-L2> child." ,
854- " - FILE format: <FILE-relative/path/to/file.v:L1-L2> (workspace-relative, e.g. rtl/dut.v:50-56)" ,
855- " Multiple ranges: <FILE-rtl/dut.v:50-56,100-105>" ,
856- " - All <FG-*>/<FC-*>/<CK-*> tags MUST exactly match those in functions_and_checks.md (case-sensitive)." ,
857- " - <BG-STATIC-000-NULL> is the ONLY tag that may appear without child tags." ,
858- "" ,
859- f"=== BATCH PROGRESS TRACKING (required at end of { self .static_doc } ) ===" ,
860- "After finishing this batch, append each analyzed file to the '## Batch Analysis Progress'" ,
861- f"table at the END of { self .static_doc } . Create the section if it does not exist yet:" ,
862- "" ,
863- " ## Batch Analysis Progress" ,
864- "" ,
865- " | Source file | Potential bugs | Status |" ,
866- " |-------------|---------------|--------|" ,
867- " | <file>rtl/dut.v</file> | 2 | ✅ Done |" ,
868- "" ,
869- " IMPORTANT: The path inside <file>…</file> MUST be the workspace-relative source file path" ,
870- " (e.g. <file>rtl/dut.v</file>). The batch checker uses these tags to detect completed files." ,
871- "" ,
872- " DO NOT confuse the two marker types:" ,
873- " <file>path</file> — lowercase, plain text — progress table only, no attributes" ,
874- " <FILE-path:L1-L2> — uppercase with colon+lines — bug source location inside LINK-BUG" ,
875- ]
876- result ["current_batch" ] = current_batch
877- result ["progress" ] = f"{ analyzed_count } /{ total } "
878- result ["remaining_files" ] = remaining
879-
880786 return passed , result
0 commit comments