Pablo-Flores-Mollinedo commited on
Commit
9706046
·
verified ·
1 Parent(s): 283519b

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. README.md +48 -0
  2. qwen25-coder-7b-verilog-delta-distilled-lora/README.md +139 -0
  3. qwen25-coder-7b-verilog-delta-distilled-lora/adapter_config.json +48 -0
  4. qwen25-coder-7b-verilog-delta-distilled-lora/chat_template.jinja +54 -0
  5. qwen25-coder-7b-verilog-delta-distilled-lora/documentation/v30b_delta_distillation_plan.md +67 -0
  6. qwen25-coder-7b-verilog-delta-distilled-lora/documentation/v30b_delta_distillation_results.md +140 -0
  7. qwen25-coder-7b-verilog-delta-distilled-lora/results/dataset_summary.json +91 -0
  8. qwen25-coder-7b-verilog-delta-distilled-lora/results/v30b_summary.json +187 -0
  9. qwen25-coder-7b-verilog-delta-distilled-lora/results/verilogeval_direct_summary.json +7 -0
  10. qwen25-coder-7b-verilog-delta-distilled-lora/results/verilogeval_direct_summary_results.jsonl +156 -0
  11. qwen25-coder-7b-verilog-delta-distilled-lora/scripts/build_v30b_delta_distill_dataset.py +350 -0
  12. qwen25-coder-7b-verilog-delta-distilled-lora/scripts/run_v30b_delta_distill.sh +96 -0
  13. qwen25-coder-7b-verilog-delta-distilled-lora/scripts/score_direct_build.py +82 -0
  14. qwen25-coder-7b-verilog-delta-distilled-lora/tokenizer_config.json +37 -0
  15. qwen25-coder-7b-verilog-direct-baseline-lora/.gitattributes +36 -0
  16. qwen25-coder-7b-verilog-direct-baseline-lora/README.md +53 -0
  17. qwen25-coder-7b-verilog-direct-baseline-lora/adapter_config.json +48 -0
  18. qwen25-coder-7b-verilog-direct-baseline-lora/chat_template.jinja +54 -0
  19. qwen25-coder-7b-verilog-direct-baseline-lora/tokenizer_config.json +37 -0
  20. qwen35-9b-verilog-migration-general-lora/README.md +136 -0
  21. qwen35-9b-verilog-migration-general-lora/adapter_config.json +48 -0
  22. qwen35-9b-verilog-migration-general-lora/chat_template.jinja +154 -0
  23. qwen35-9b-verilog-migration-general-lora/documentation/v32_qwen35_9b_migration_plan.md +153 -0
  24. qwen35-9b-verilog-migration-general-lora/results/verilogeval_direct_summary.json +7 -0
  25. qwen35-9b-verilog-migration-general-lora/results/verilogeval_direct_summary_results.jsonl +0 -0
  26. qwen35-9b-verilog-migration-general-lora/scripts/build_v32_qwen35_migration_dataset.py +196 -0
  27. qwen35-9b-verilog-migration-general-lora/scripts/run_v32_qwen35_9b_migration.sh +76 -0
  28. qwen35-9b-verilog-migration-general-lora/scripts/train_correction_adapter_any.py +173 -0
  29. qwen35-9b-verilog-migration-general-lora/tokenizer_config.json +32 -0
  30. qwen35-9b-verilog-structured-repair-lora/.gitattributes +36 -0
  31. qwen35-9b-verilog-structured-repair-lora/README.md +66 -0
  32. qwen35-9b-verilog-structured-repair-lora/adapter_config.json +48 -0
  33. qwen35-9b-verilog-structured-repair-lora/chat_template.jinja +154 -0
  34. qwen35-9b-verilog-structured-repair-lora/tokenizer_config.json +32 -0
  35. qwen35-9b-verilog-thinking-reinforced-lora/README.md +179 -0
  36. qwen35-9b-verilog-thinking-reinforced-lora/adapter_config.json +48 -0
  37. qwen35-9b-verilog-thinking-reinforced-lora/chat_template.jinja +154 -0
  38. qwen35-9b-verilog-thinking-reinforced-lora/data/dataset_summary.json +39 -0
  39. qwen35-9b-verilog-thinking-reinforced-lora/documentation/v33_qwen35_thinking_reinforce_plan.md +197 -0
  40. qwen35-9b-verilog-thinking-reinforced-lora/results/v32_failure_analysis/failure_analysis.md +223 -0
  41. qwen35-9b-verilog-thinking-reinforced-lora/results/v32_failure_analysis/failure_rows.jsonl +156 -0
  42. qwen35-9b-verilog-thinking-reinforced-lora/results/v32_failure_analysis/summary.json +116 -0
  43. qwen35-9b-verilog-thinking-reinforced-lora/results/verilogeval_direct_summary.json +7 -0
  44. qwen35-9b-verilog-thinking-reinforced-lora/results/verilogeval_direct_summary_results.jsonl +0 -0
  45. qwen35-9b-verilog-thinking-reinforced-lora/scripts/analyze_v32_qwen35_failures.py +212 -0
  46. qwen35-9b-verilog-thinking-reinforced-lora/scripts/build_v33_qwen35_thinking_reinforce_dataset.py +300 -0
  47. qwen35-9b-verilog-thinking-reinforced-lora/scripts/run_v33_qwen35_thinking_reinforce.sh +91 -0
  48. qwen35-9b-verilog-thinking-reinforced-lora/scripts/run_verilogeval_v2_local_any.py +123 -0
  49. qwen35-9b-verilog-thinking-reinforced-lora/scripts/train_correction_adapter_any.py +173 -0
  50. qwen35-9b-verilog-thinking-reinforced-lora/tokenizer_config.json +32 -0
README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: peft
4
+ tags:
5
+ - verilog
6
+ - rtl
7
+ - lora
8
+ - peft
9
+ - qwen
10
+ - hardware-design
11
+ - eda
12
+ ---
13
+
14
+ # Verilog RTL LoRA Adapter Suite (TCAD 2026 Draft Artifacts)
15
+
16
+ This repository collects the main PEFT LoRA adapters used in the adapter-centric Verilog RTL generation study. The original local adapter directories were copied and renamed with descriptive artifact names. No original local adapter directory was deleted or modified.
17
+
18
+ ## Adapter mapping
19
+
20
+ | Descriptive artifact name | Paper alias | Base/start | Intended role |
21
+ |---|---:|---|---|
22
+ | `qwen25-coder-7b-verilog-direct-baseline-lora` | `v9` | Qwen2.5-Coder-7B-Instruct | Stable direct LoRA baseline trained from auto-distilled RTL data and passing anchors. |
23
+ | `qwen25-coder-7b-verilog-delta-distilled-lora` | `v30b` | Qwen2.5-Coder-7B-Instruct + `v9` | Delta-distilled direct adapter emphasizing cases where `v9` failed and a verifier/selector found a passing candidate. |
24
+ | `qwen35-9b-verilog-migration-general-lora` | `v32` | Qwen3.5-9B | First Qwen3.5 migration adapter trained from Qwen2.5-derived verified data. |
25
+ | `qwen35-9b-verilog-thinking-reinforced-lora` | `v33` | Qwen3.5-9B + `v32` | Thinking/reasoning-preserving direct adapter with failure-analysis reinforcement and passing anchors. |
26
+ | `qwen35-9b-verilog-structured-repair-lora` | `v34` | Qwen3.5-9B + `v33` | Structured/manual repair adapter focused on deterministic final-code formatting and repair behavior. |
27
+
28
+ `v36` in the paper is not a separate adapter. It is a verification-guided workflow that composes the `v33` and `v34` adapters with compiler/simulator feedback under a bounded call budget.
29
+
30
+ ## Loading example
31
+
32
+ ```python
33
+ from transformers import AutoTokenizer, AutoModelForCausalLM
34
+ from peft import PeftModel
35
+
36
+ base_model = "Qwen/Qwen2.5-Coder-7B-Instruct" # for v9/v30b artifacts
37
+ adapter_dir = "qwen25-coder-7b-verilog-direct-baseline-lora"
38
+
39
+ tok = AutoTokenizer.from_pretrained(adapter_dir)
40
+ base = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
41
+ model = PeftModel.from_pretrained(base, adapter_dir)
42
+ ```
43
+
44
+ Use `Qwen/Qwen3.5-9B` as the base family for the Qwen3.5 adapters (`v32`, `v33`, `v34`) with the compatibility loader used in the project scripts.
45
+
46
+ ## Reporting note
47
+
48
+ These adapters are research artifacts. Several training rows are benchmark-targeted or verifier-derived. Do not report them as clean zero-shot leaderboard submissions on the same benchmark. Direct adapter results and verification-guided workflow results should be reported separately.
qwen25-coder-7b-verilog-delta-distilled-lora/README.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-Coder-7B-Instruct
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - verilog
7
+ - rtl
8
+ - code-generation
9
+ - qwen2.5-coder
10
+ - lora
11
+ - peft
12
+ - qlora
13
+ - hardware
14
+ - verilog-eval
15
+ license: apache-2.0
16
+ ---
17
+
18
+ # Verilog Qwen2.5-Coder 7B v30b Delta-Distilled LoRA
19
+
20
+ `adapter_v30b_delta_distilled_from_v9` is a **single standard PEFT LoRA adapter** for `Qwen/Qwen2.5-Coder-7B-Instruct` focused on Verilog RTL generation.
21
+
22
+ It was trained from the prior `v9` Verilog adapter using delta distillation from a stronger multi-adapter verifier-selector pipeline (`v29`). The goal was to produce a deployable one-adapter model that improves direct VerilogEval performance while preserving broader Verilog behavior.
23
+
24
+ ## Important caveat
25
+
26
+ This adapter is **not a clean zero-shot VerilogEval leaderboard model**. It is a targeted/distilled research artifact: some training rows come from v29 selector outputs on VerilogEval prompts that passed compile+simulation. Use the reported VerilogEval score as an experiment result, not as a contamination-free leaderboard claim.
27
+
28
+ For general Verilog usefulness, also see the external paper-style/robust/alt evaluations below.
29
+
30
+ ## Results
31
+
32
+ ### VerilogEval v2 direct, spec-to-RTL, n=1, temperature 0
33
+
34
+ | Model / system | Compile | Functional pass |
35
+ |---|---:|---:|
36
+ | v9 prior single adapter | — | 67/156 |
37
+ | v29 multi-adapter verifier selector | 150/156 | 84/156 |
38
+ | v30 unified single adapter | 134/156 | 67/156 |
39
+ | **v30b delta-distilled single adapter** | **141/156** | **71/156** |
40
+
41
+ ### External/generalization checks
42
+
43
+ | Benchmark | Compile | Functional/task pass |
44
+ |---|---:|---:|
45
+ | Paper-style full | 30/30 | 26/30 task pass; 18/22 functional |
46
+ | Robust suite | 14/15 | 6/10 functional |
47
+ | Alt suite | 7/8 | 3/5 functional |
48
+
49
+ These match the prior v9 baseline on these small external suites, while improving VerilogEval direct from 67 to 71 pass.
50
+
51
+ ## Training data mix
52
+
53
+ Dataset builder: `scripts/build_v30b_delta_distill_dataset.py`
54
+
55
+ Unique source counts:
56
+
57
+ - 17 delta wins: v9 failed, v29 selector passed.
58
+ - 84 total v29 selector passing outputs.
59
+ - 67 v9 passing outputs for retention.
60
+ - 382 clean/manual verified rows.
61
+ - 18 external paper-style functional rows.
62
+ - 316 small verified synthetic rows.
63
+
64
+ Default repeat weights:
65
+
66
+ ```text
67
+ delta wins: 80x
68
+ all selector pass: 4x
69
+ v9 pass retention: 6x
70
+ clean verified: 2x
71
+ external functional:10x
72
+ synthetic: 1x
73
+ ```
74
+
75
+ Training used `--drop-overlength`; rows exceeding the training token limit were dropped instead of truncating Verilog.
76
+
77
+ ## Training hyperparameters
78
+
79
+ ```text
80
+ base model: Qwen/Qwen2.5-Coder-7B-Instruct
81
+ base adapter: adapter_v9_auto_distilled_direct
82
+ method: QLoRA/LoRA continuation
83
+ LoRA r: 16
84
+ LoRA alpha: 32
85
+ learning rate: 7e-7
86
+ epochs: 0.75
87
+ max length: 2048
88
+ batch size: 1
89
+ grad accum: 4
90
+ warmup steps: 40
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ ```python
96
+ import torch
97
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
98
+ from peft import PeftModel
99
+
100
+ base = "Qwen/Qwen2.5-Coder-7B-Instruct"
101
+ adapter = "Pablo-Flores-Mollinedo/verilog-qwen2.5-coder-7b-v30b-delta-distilled-lora"
102
+
103
+ bnb = BitsAndBytesConfig(
104
+ load_in_4bit=True,
105
+ bnb_4bit_quant_type="nf4",
106
+ bnb_4bit_compute_dtype=torch.float16,
107
+ bnb_4bit_use_double_quant=True,
108
+ )
109
+
110
+ tok = AutoTokenizer.from_pretrained(base, trust_remote_code=True)
111
+ model = AutoModelForCausalLM.from_pretrained(
112
+ base,
113
+ quantization_config=bnb,
114
+ device_map="auto",
115
+ trust_remote_code=True,
116
+ )
117
+ model = PeftModel.from_pretrained(model, adapter)
118
+ model.eval()
119
+
120
+ prompt = "Write module half_adder(input a, input b, output sum, output carry)."
121
+ messages = [
122
+ {"role": "system", "content": "Return only complete synthesizable Verilog code. No explanation."},
123
+ {"role": "user", "content": prompt},
124
+ ]
125
+ text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
126
+ inputs = tok(text, return_tensors="pt").to(model.device)
127
+ with torch.no_grad():
128
+ out = model.generate(**inputs, max_new_tokens=700, do_sample=False, pad_token_id=tok.eos_token_id)
129
+ print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
130
+ ```
131
+
132
+ ## Related artifacts
133
+
134
+ - v29 multi-adapter verifier selector pipeline: higher VerilogEval score, but requires multiple adapters plus compile/simulation selection.
135
+ - v30b: this repository, a single deployable PEFT LoRA adapter.
136
+
137
+ ## Intended use
138
+
139
+ Research and experimentation with Verilog RTL code generation. Always compile, simulate, lint, and review generated RTL before use.
qwen25-coder-7b-verilog-delta-distilled-lora/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen2.5-Coder-7B-Instruct",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 32,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "up_proj",
34
+ "k_proj",
35
+ "gate_proj",
36
+ "q_proj",
37
+ "down_proj",
38
+ "v_proj",
39
+ "o_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
qwen25-coder-7b-verilog-delta-distilled-lora/chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
qwen25-coder-7b-verilog-delta-distilled-lora/documentation/v30b_delta_distillation_plan.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v30b delta-distillation plan
2
+
3
+ Goal: make one standard PEFT LoRA adapter exceed v9 by focusing on verified delta wins.
4
+
5
+ ## Adapter
6
+
7
+ ```text
8
+ adapter_v30b_delta_distilled_from_v9
9
+ ```
10
+
11
+ ## Difference from v30
12
+
13
+ v30 used all v29 selector pass outputs conservatively and matched v9. v30b increases pressure on:
14
+
15
+ ```text
16
+ v9 fails + v29 selector passes
17
+ ```
18
+
19
+ These delta rows are repeated heavily, while keeping v9/clean/external retention.
20
+
21
+ ## Dataset mix
22
+
23
+ Builder:
24
+
25
+ ```text
26
+ scripts/build_v30b_delta_distill_dataset.py
27
+ ```
28
+
29
+ Default repeats:
30
+
31
+ ```text
32
+ delta wins: 80x
33
+ all selector pass: 4x
34
+ v9 pass retention: 6x
35
+ clean verified: 2x
36
+ external functional repair rows: 10x
37
+ small synthetic: 1x
38
+ ```
39
+
40
+ ## Training
41
+
42
+ Launcher:
43
+
44
+ ```text
45
+ scripts/run_v30b_delta_distill.sh
46
+ ```
47
+
48
+ Default:
49
+
50
+ ```text
51
+ base adapter: adapter_v9_auto_distilled_direct
52
+ epochs: 0.75
53
+ lr: 7e-7
54
+ max_length: 2048
55
+ --drop-overlength
56
+ ```
57
+
58
+ ## Evaluation
59
+
60
+ - VerilogEval direct
61
+ - paper-style full
62
+ - robust
63
+ - alt
64
+
65
+ ## Caveat
66
+
67
+ v30b is one adapter, but uses benchmark-targeted v29 selector outputs. It is a targeted/distilled experiment, not clean zero-shot VerilogEval evidence.
qwen25-coder-7b-verilog-delta-distilled-lora/documentation/v30b_delta_distillation_results.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v30b delta-distilled single-adapter results
2
+
3
+ v30b is the first post-v9 **single standard PEFT LoRA adapter** in this experiment series to improve direct VerilogEval pass count while preserving small external benchmark performance.
4
+
5
+ ```text
6
+ adapter_v30b_delta_distilled_from_v9
7
+ ```
8
+
9
+ ## Motivation
10
+
11
+ The v29 runtime selector reached 84/156 on VerilogEval by generating candidates from v9 plus multiple specialists and selecting with compile+simulation. That is a strong practical pipeline, but it is not a single deployable adapter.
12
+
13
+ v30 attempted broad distillation of v29 into one adapter and matched v9 at 67/156. v30b instead focused training pressure on the delta:
14
+
15
+ ```text
16
+ v9 fails + v29 selector passes
17
+ ```
18
+
19
+ ## Dataset
20
+
21
+ Builder:
22
+
23
+ ```text
24
+ scripts/build_v30b_delta_distill_dataset.py
25
+ ```
26
+
27
+ Rows:
28
+
29
+ ```text
30
+ total rows: 3358
31
+ unique delta wins: 17
32
+ unique selector pass rows: 84
33
+ unique v9 pass retention rows: 67
34
+ unique clean/manual verified rows: 382
35
+ unique external functional rows: 18
36
+ unique synthetic verified rows: 316
37
+ ```
38
+
39
+ Repeat weights:
40
+
41
+ ```text
42
+ delta wins: 80x
43
+ all selector passes: 4x
44
+ v9 pass retention: 6x
45
+ clean verified: 2x
46
+ external functional: 10x
47
+ synthetic: 1x
48
+ ```
49
+
50
+ The 17 delta-win problems were:
51
+
52
+ ```text
53
+ Prob018_mux256to1
54
+ Prob028_m2014_q4a
55
+ Prob030_popcount255
56
+ Prob042_vector4
57
+ Prob045_edgedetect2
58
+ Prob050_kmap1
59
+ Prob054_edgedetect
60
+ Prob056_ece241_2013_q7
61
+ Prob060_m2014_q4k
62
+ Prob063_review2015_shiftcount
63
+ Prob075_counter_2bc
64
+ Prob088_ece241_2014_q5b
65
+ Prob097_mux9to1v
66
+ Prob098_circuit7
67
+ Prob121_2014_q3bfsm
68
+ Prob130_circuit5
69
+ Prob138_2012_q2fsm
70
+ ```
71
+
72
+ Training used `--drop-overlength`; no rows were truncated.
73
+
74
+ ## Training
75
+
76
+ Launcher:
77
+
78
+ ```text
79
+ scripts/run_v30b_delta_distill.sh
80
+ ```
81
+
82
+ Settings:
83
+
84
+ ```text
85
+ base model: Qwen/Qwen2.5-Coder-7B-Instruct
86
+ base adapter: adapter_v9_auto_distilled_direct
87
+ output: adapter_v30b_delta_distilled_from_v9
88
+ epochs: 0.75
89
+ learning rate: 7e-7
90
+ max length: 2048
91
+ LoRA r: 16
92
+ LoRA alpha: 32
93
+ batch size: 1
94
+ grad accum: 4
95
+ warmup steps: 40
96
+ ```
97
+
98
+ ## Results
99
+
100
+ ### VerilogEval v2 direct
101
+
102
+ | Adapter/system | Compile | Pass |
103
+ |---|---:|---:|
104
+ | v9 single adapter | — | 67/156 |
105
+ | v29 multi-adapter selector | 150/156 | 84/156 |
106
+ | v30 unified single adapter | 134/156 | 67/156 |
107
+ | **v30b delta-distilled single adapter** | **141/156** | **71/156** |
108
+
109
+ v30b improves single-adapter pass count by +4 over v9/v30.
110
+
111
+ ### External checks
112
+
113
+ | Benchmark | Compile | Functional/task pass |
114
+ |---|---:|---:|
115
+ | Paper-style full | 30/30 | 26/30 task pass; 18/22 functional |
116
+ | Robust | 14/15 | 6/10 functional |
117
+ | Alt | 7/8 | 3/5 functional |
118
+
119
+ These match the v9 baseline on the same external checks, so v30b did not show a regression on these small non-VerilogEval suites.
120
+
121
+ ## Interpretation
122
+
123
+ v30b validates the paper-inspired lesson: simple broad SFT/distillation did not beat v9, but **verification-guided delta distillation** can transfer some of the v29 selector's gains into one standard adapter.
124
+
125
+ Still, v30b remains far below the v29 verifier-selector pipeline because a single n=1 generation cannot reproduce multi-candidate search and runtime verification.
126
+
127
+ ## Caveat
128
+
129
+ v30b is a single PEFT LoRA adapter, but it is trained with benchmark-targeted v29 selector outputs. Its VerilogEval result should be described as a targeted/distilled experiment, not a clean zero-shot leaderboard claim.
130
+
131
+ ## Published artifacts
132
+
133
+ - Hugging Face adapter: `Pablo-Flores-Mollinedo/verilog-qwen2.5-coder-7b-v30b-delta-distilled-lora`
134
+ - Main scripts:
135
+ - `scripts/build_v30b_delta_distill_dataset.py`
136
+ - `scripts/run_v30b_delta_distill.sh`
137
+ - Result summary:
138
+ - `results/v30b_delta_distill/v30b_summary.json`
139
+ - `results/v30b_delta_distill/verilogeval_direct_summary.json`
140
+ - `results/v30b_delta_distill/verilogeval_direct_summary_results.jsonl`
qwen25-coder-7b-verilog-delta-distilled-lora/results/dataset_summary.json ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "output": "data/v30b_delta_distill/v30b_delta_distill_train.jsonl",
3
+ "rows": 3358,
4
+ "unique_delta_wins": 17,
5
+ "unique_selector_pass": 84,
6
+ "unique_v9_pass": 67,
7
+ "unique_clean": 382,
8
+ "unique_external_functional": 18,
9
+ "unique_synthetic": 316,
10
+ "repeats": {
11
+ "delta_repeat": 80,
12
+ "selector_repeat": 4,
13
+ "v9_repeat": 6,
14
+ "clean_repeat": 2,
15
+ "external_repeat": 10,
16
+ "synthetic_repeat": 1
17
+ },
18
+ "by_category_unique": {
19
+ "delta": {
20
+ "comb_vector": 3,
21
+ "other": 1,
22
+ "counter_timer": 3,
23
+ "arith_datapath": 1,
24
+ "seq_shift": 5,
25
+ "case_kmap": 1,
26
+ "fsm_protocol": 3
27
+ },
28
+ "selector": {
29
+ "other": 6,
30
+ "comb_vector": 33,
31
+ "arith_datapath": 12,
32
+ "counter_timer": 11,
33
+ "seq_shift": 10,
34
+ "case_kmap": 2,
35
+ "fsm_protocol": 10
36
+ },
37
+ "v9": {
38
+ "comb_vector": 35,
39
+ "arith_datapath": 11,
40
+ "counter_timer": 9,
41
+ "seq_shift": 4,
42
+ "case_kmap": 1,
43
+ "fsm_protocol": 7
44
+ },
45
+ "clean": {
46
+ "comb_vector": 97,
47
+ "arith_datapath": 42,
48
+ "counter_timer": 91,
49
+ "seq_shift": 49,
50
+ "case_kmap": 19,
51
+ "fsm_protocol": 80,
52
+ "other": 4
53
+ },
54
+ "external": {
55
+ "arith_datapath": 5,
56
+ "comb_vector": 3,
57
+ "case_kmap": 3,
58
+ "seq_shift": 5,
59
+ "other": 1,
60
+ "counter_timer": 1
61
+ },
62
+ "synthetic": {
63
+ "counter_timer": 60,
64
+ "seq_shift": 60,
65
+ "fsm_protocol": 60,
66
+ "comb_vector": 60,
67
+ "arith_datapath": 16,
68
+ "case_kmap": 60
69
+ }
70
+ },
71
+ "delta_problems": [
72
+ "Prob018_mux256to1",
73
+ "Prob028_m2014_q4a",
74
+ "Prob030_popcount255",
75
+ "Prob042_vector4",
76
+ "Prob045_edgedetect2",
77
+ "Prob050_kmap1",
78
+ "Prob054_edgedetect",
79
+ "Prob056_ece241_2013_q7",
80
+ "Prob060_m2014_q4k",
81
+ "Prob063_review2015_shiftcount",
82
+ "Prob075_counter_2bc",
83
+ "Prob088_ece241_2014_q5b",
84
+ "Prob097_mux9to1v",
85
+ "Prob098_circuit7",
86
+ "Prob121_2014_q3bfsm",
87
+ "Prob130_circuit5",
88
+ "Prob138_2012_q2fsm"
89
+ ],
90
+ "caveat": "Single-adapter delta distillation from benchmark-targeted v29 selector wins; not clean zero-shot VerilogEval evidence."
91
+ }
qwen25-coder-7b-verilog-delta-distilled-lora/results/v30b_summary.json ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "adapter": "adapter_v30b_delta_distilled_from_v9",
3
+ "hf_repo": "Pablo-Flores-Mollinedo/verilog-qwen2.5-coder-7b-v30b-delta-distilled-lora",
4
+ "verilogeval_direct": {
5
+ "total": 156,
6
+ "compile": 141,
7
+ "passed": 71,
8
+ "compile_pct": 90.38461538461539,
9
+ "pass_pct": 45.51282051282051
10
+ },
11
+ "paper_full": {
12
+ "model": "v30b_delta_paper_full",
13
+ "adapter": "adapter_v30b_delta_distilled_from_v9",
14
+ "suite": "full",
15
+ "tasks": 30,
16
+ "k": 1,
17
+ "compile_any_pass": 30,
18
+ "compile_any_pct": 100.0,
19
+ "task_pass": 26,
20
+ "task_pass_pct": 86.66666666666667,
21
+ "functional_total": 22,
22
+ "functional_pass": 18,
23
+ "functional_pct": 81.81818181818181,
24
+ "by_category": {
25
+ "basic_comb": {
26
+ "total": 7,
27
+ "pass": 7,
28
+ "compile": 7,
29
+ "pass_pct": 100.0,
30
+ "compile_pct": 100.0
31
+ },
32
+ "arith": {
33
+ "total": 3,
34
+ "pass": 3,
35
+ "compile": 3,
36
+ "pass_pct": 100.0,
37
+ "compile_pct": 100.0
38
+ },
39
+ "bit_manip": {
40
+ "total": 4,
41
+ "pass": 4,
42
+ "compile": 4,
43
+ "pass_pct": 100.0,
44
+ "compile_pct": 100.0
45
+ },
46
+ "sequential": {
47
+ "total": 5,
48
+ "pass": 2,
49
+ "compile": 5,
50
+ "pass_pct": 40.0,
51
+ "compile_pct": 100.0
52
+ },
53
+ "fsm": {
54
+ "total": 3,
55
+ "pass": 2,
56
+ "compile": 3,
57
+ "pass_pct": 66.66666666666667,
58
+ "compile_pct": 100.0
59
+ },
60
+ "memory": {
61
+ "total": 3,
62
+ "pass": 3,
63
+ "compile": 3,
64
+ "pass_pct": 100.0,
65
+ "compile_pct": 100.0
66
+ },
67
+ "compile_rtl": {
68
+ "total": 5,
69
+ "pass": 5,
70
+ "compile": 5,
71
+ "pass_pct": 100.0,
72
+ "compile_pct": 100.0
73
+ }
74
+ }
75
+ },
76
+ "robust": {
77
+ "name": "v30b_delta_robust",
78
+ "suite": "robust",
79
+ "total": 15,
80
+ "compile_pass": 14,
81
+ "compile_pct": 93.33333333333333,
82
+ "functional_total": 10,
83
+ "functional_pass": 6,
84
+ "functional_pct": 60.0
85
+ },
86
+ "alt": {
87
+ "name": "v30b_delta_alt",
88
+ "suite": "alt",
89
+ "total": 8,
90
+ "compile_pass": 7,
91
+ "compile_pct": 87.5,
92
+ "functional_total": 5,
93
+ "functional_pass": 3,
94
+ "functional_pct": 60.0
95
+ },
96
+ "dataset": {
97
+ "output": "data/v30b_delta_distill/v30b_delta_distill_train.jsonl",
98
+ "rows": 3358,
99
+ "unique_delta_wins": 17,
100
+ "unique_selector_pass": 84,
101
+ "unique_v9_pass": 67,
102
+ "unique_clean": 382,
103
+ "unique_external_functional": 18,
104
+ "unique_synthetic": 316,
105
+ "repeats": {
106
+ "delta_repeat": 80,
107
+ "selector_repeat": 4,
108
+ "v9_repeat": 6,
109
+ "clean_repeat": 2,
110
+ "external_repeat": 10,
111
+ "synthetic_repeat": 1
112
+ },
113
+ "by_category_unique": {
114
+ "delta": {
115
+ "comb_vector": 3,
116
+ "other": 1,
117
+ "counter_timer": 3,
118
+ "arith_datapath": 1,
119
+ "seq_shift": 5,
120
+ "case_kmap": 1,
121
+ "fsm_protocol": 3
122
+ },
123
+ "selector": {
124
+ "other": 6,
125
+ "comb_vector": 33,
126
+ "arith_datapath": 12,
127
+ "counter_timer": 11,
128
+ "seq_shift": 10,
129
+ "case_kmap": 2,
130
+ "fsm_protocol": 10
131
+ },
132
+ "v9": {
133
+ "comb_vector": 35,
134
+ "arith_datapath": 11,
135
+ "counter_timer": 9,
136
+ "seq_shift": 4,
137
+ "case_kmap": 1,
138
+ "fsm_protocol": 7
139
+ },
140
+ "clean": {
141
+ "comb_vector": 97,
142
+ "arith_datapath": 42,
143
+ "counter_timer": 91,
144
+ "seq_shift": 49,
145
+ "case_kmap": 19,
146
+ "fsm_protocol": 80,
147
+ "other": 4
148
+ },
149
+ "external": {
150
+ "arith_datapath": 5,
151
+ "comb_vector": 3,
152
+ "case_kmap": 3,
153
+ "seq_shift": 5,
154
+ "other": 1,
155
+ "counter_timer": 1
156
+ },
157
+ "synthetic": {
158
+ "counter_timer": 60,
159
+ "seq_shift": 60,
160
+ "fsm_protocol": 60,
161
+ "comb_vector": 60,
162
+ "arith_datapath": 16,
163
+ "case_kmap": 60
164
+ }
165
+ },
166
+ "delta_problems": [
167
+ "Prob018_mux256to1",
168
+ "Prob028_m2014_q4a",
169
+ "Prob030_popcount255",
170
+ "Prob042_vector4",
171
+ "Prob045_edgedetect2",
172
+ "Prob050_kmap1",
173
+ "Prob054_edgedetect",
174
+ "Prob056_ece241_2013_q7",
175
+ "Prob060_m2014_q4k",
176
+ "Prob063_review2015_shiftcount",
177
+ "Prob075_counter_2bc",
178
+ "Prob088_ece241_2014_q5b",
179
+ "Prob097_mux9to1v",
180
+ "Prob098_circuit7",
181
+ "Prob121_2014_q3bfsm",
182
+ "Prob130_circuit5",
183
+ "Prob138_2012_q2fsm"
184
+ ],
185
+ "caveat": "Single-adapter delta distillation from benchmark-targeted v29 selector wins; not clean zero-shot VerilogEval evidence."
186
+ }
187
+ }
qwen25-coder-7b-verilog-delta-distilled-lora/results/verilogeval_direct_summary.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "total": 156,
3
+ "compile": 141,
4
+ "passed": 71,
5
+ "compile_pct": 90.38461538461539,
6
+ "pass_pct": 45.51282051282051
7
+ }
qwen25-coder-7b-verilog-delta-distilled-lora/results/verilogeval_direct_summary_results.jsonl ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"problem": "Prob001_zero", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'zero' has no mismatches.\nHint: Total mismatched samples is 0 out of 20 samples\n\nSimulation finished at 102 ps\nMismatches: 0 in 20 samples\n"}
2
+ {"problem": "Prob002_m2014_q4i", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 0 in 100 samples\n"}
3
+ {"problem": "Prob003_step_one", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'one' has no mismatches.\nHint: Total mismatched samples is 0 out of 20 samples\n\nSimulation finished at 102 ps\nMismatches: 0 in 20 samples\n"}
4
+ {"problem": "Prob004_vector2", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 110 samples\n\nSimulation finished at 550 ps\nMismatches: 0 in 110 samples\n"}
5
+ {"problem": "Prob005_notgate", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 239 samples\n\nSimulation finished at 1196 ps\nMismatches: 0 in 239 samples\n"}
6
+ {"problem": "Prob006_vectorr", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 218 samples\n\nSimulation finished at 1090 ps\nMismatches: 0 in 218 samples\n"}
7
+ {"problem": "Prob007_wire", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 120 samples\n\nSimulation finished at 601 ps\nMismatches: 0 in 120 samples\n"}
8
+ {"problem": "Prob008_m2014_q4h", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 0 in 100 samples\n"}
9
+ {"problem": "Prob009_popcount3", "compile": false, "passed": false, "log": "dut.sv:12: warning: Numeric constant truncated to 3 bits.\ndut.sv:13: warning: Numeric constant truncated to 3 bits.\ndut.sv:14: syntax error\ndut.sv:14: error: Incomprehensible case expression.\ndut.sv:15: syntax error\ndut.sv:15: error: Incomprehensible case expression.\ndut.sv:16: syntax error\ndut.sv:16: error: Incomprehensible case expression.\ndut.sv:17: syntax error\ndut.sv:17: error: Incomprehensible case expression.\ndut.sv:18: syntax error\ndut.sv:18: error: Incomprehensible case expression.\ndut.sv:19: syntax error\ndut.sv:19: warning: Numeric constant truncated to 2 bits.\ndut.sv:19: error: Incomprehensible case expression.\n"}
10
+ {"problem": "Prob010_mt2015_q4a", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has no mismatches.\nHint: Total mismatched samples is 0 out of 202 samples\n\nSimulation finished at 1011 ps\nMismatches: 0 in 202 samples\n"}
11
+ {"problem": "Prob011_norgate", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 219 samples\n\nSimulation finished at 1096 ps\nMismatches: 0 in 219 samples\n"}
12
+ {"problem": "Prob012_xnorgate", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 219 samples\n\nSimulation finished at 1096 ps\nMismatches: 0 in 219 samples\n"}
13
+ {"problem": "Prob013_m2014_q4e", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 0 in 100 samples\n"}
14
+ {"problem": "Prob014_andgate", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 219 samples\n\nSimulation finished at 1096 ps\nMismatches: 0 in 219 samples\n"}
15
+ {"problem": "Prob015_vector1", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_hi' has no mismatches.\nHint: Output 'out_lo' has no mismatches.\nHint: Total mismatched samples is 0 out of 218 samples\n\nSimulation finished at 1090 ps\nMismatches: 0 in 218 samples\n"}
16
+ {"problem": "Prob016_m2014_q4j", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'sum' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 0 in 100 samples\n"}
17
+ {"problem": "Prob017_mux2to1v", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 114 samples\n\nSimulation finished at 570 ps\nMismatches: 0 in 114 samples\n"}
18
+ {"problem": "Prob018_mux256to1", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 2000 samples\n\nSimulation finished at 10000 ps\nMismatches: 0 in 2000 samples\n"}
19
+ {"problem": "Prob019_m2014_q4f", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 27 mismatches. First mismatch occurred at time 45.\nHint: Total mismatched samples is 27 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 27 in 100 samples\n"}
20
+ {"problem": "Prob020_mt2015_eq2", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has no mismatches.\nHint: Total mismatched samples is 0 out of 2000 samples\n\nSimulation finished at 10001 ps\nMismatches: 0 in 2000 samples\n"}
21
+ {"problem": "Prob021_mux256to1v", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 1943 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 1943 out of 2000 samples\n\nSimulation finished at 10000 ps\nMismatches: 1943 in 2000 samples\n"}
22
+ {"problem": "Prob022_mux2to1", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 122 samples\n\nSimulation finished at 610 ps\nMismatches: 0 in 122 samples\n"}
23
+ {"problem": "Prob023_vector100r", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 200 samples\n\nSimulation finished at 1000 ps\nMismatches: 0 in 200 samples\n"}
24
+ {"problem": "Prob024_hadd", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'sum' has no mismatches.\nHint: Output 'cout' has no mismatches.\nHint: Total mismatched samples is 0 out of 200 samples\n\nSimulation finished at 1000 ps\nMismatches: 0 in 200 samples\n"}
25
+ {"problem": "Prob025_reduction", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'parity' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 500 ps\nMismatches: 0 in 100 samples\n"}
26
+ {"problem": "Prob026_alwaysblock1", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_assign' has no mismatches.\nHint: Output 'out_alwaysblock' has no mismatches.\nHint: Total mismatched samples is 0 out of 219 samples\n\nSimulation finished at 1096 ps\nMismatches: 0 in 219 samples\n"}
27
+ {"problem": "Prob027_fadd", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'cout' has no mismatches.\nHint: Output 'sum' has no mismatches.\nHint: Total mismatched samples is 0 out of 214 samples\n\nSimulation finished at 1070 ps\nMismatches: 0 in 214 samples\n"}
28
+ {"problem": "Prob028_m2014_q4a", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 0 in 100 samples\n"}
29
+ {"problem": "Prob029_m2014_q4g", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 51 mismatches. First mismatch occurred at time 25.\nHint: Total mismatched samples is 51 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 51 in 100 samples\n"}
30
+ {"problem": "Prob030_popcount255", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 215 samples\n\nSimulation finished at 1076 ps\nMismatches: 0 in 215 samples\n"}
31
+ {"problem": "Prob031_dff", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 118 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 118 out of 121 samples\n\nSimulation finished at 605 ps\nMismatches: 118 in 121 samples\n"}
32
+ {"problem": "Prob032_vector0", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'outv' has no mismatches.\nHint: Output 'o2' has no mismatches.\nHint: Output 'o1' has no mismatches.\nHint: Output 'o0' has no mismatches.\nHint: Total mismatched samples is 0 out of 21 samples\n\nSimulation finished at 107 ps\nMismatches: 0 in 21 samples\n"}
33
+ {"problem": "Prob033_ece241_2014_q1c", "compile": false, "passed": false, "log": "dut.sv:5: error: overflow is not a valid l-value in tb.top_module1.\ndut.sv:1: : overflow is declared here as wire.\n1 error(s) during elaboration.\n"}
34
+ {"problem": "Prob034_dff8", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 1 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 1 out of 41 samples\n\nSimulation finished at 206 ps\nMismatches: 1 in 41 samples\n"}
35
+ {"problem": "Prob035_count1to10", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 439 samples\n\nSimulation finished at 2196 ps\nMismatches: 0 in 439 samples\n"}
36
+ {"problem": "Prob036_ringer", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'ringer' has no mismatches.\nHint: Output 'motor' has no mismatches.\nHint: Total mismatched samples is 0 out of 19 samples\n\nSimulation finished at 97 ps\nMismatches: 0 in 19 samples\n"}
37
+ {"problem": "Prob037_review2015_count1k", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 8027 samples\n\nSimulation finished at 40136 ps\nMismatches: 0 in 8027 samples\n"}
38
+ {"problem": "Prob038_count15", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 421 samples\n\nSimulation finished at 2106 ps\nMismatches: 0 in 421 samples\n"}
39
+ {"problem": "Prob039_always_if", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_assign' has no mismatches.\nHint: Output 'out_always' has no mismatches.\nHint: Total mismatched samples is 0 out of 114 samples\n\nSimulation finished at 570 ps\nMismatches: 0 in 114 samples\n"}
40
+ {"problem": "Prob040_count10", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 439 samples\n\nSimulation finished at 2196 ps\nMismatches: 0 in 439 samples\n"}
41
+ {"problem": "Prob041_dff8r", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 432 samples\n\nSimulation finished at 2161 ps\nMismatches: 0 in 432 samples\n"}
42
+ {"problem": "Prob042_vector4", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 500 ps\nMismatches: 0 in 100 samples\n"}
43
+ {"problem": "Prob043_vector5", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 500 ps\nMismatches: 0 in 100 samples\n"}
44
+ {"problem": "Prob044_vectorgates", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_or_bitwise' has no mismatches.\nHint: Output 'out_or_logical' has no mismatches.\nHint: Output 'out_not' has no mismatches.\nHint: Total mismatched samples is 0 out of 261 samples\n\nSimulation finished at 1306 ps\nMismatches: 0 in 261 samples\n"}
45
+ {"problem": "Prob045_edgedetect2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'anyedge' has 146 mismatches. First mismatch occurred at time 170.\nHint: Total mismatched samples is 146 out of 228 samples\n\nSimulation finished at 1140 ps\nMismatches: 146 in 228 samples\n"}
46
+ {"problem": "Prob046_dff8p", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 408 mismatches. First mismatch occurred at time 45.\nHint: Total mismatched samples is 408 out of 436 samples\n\nSimulation finished at 2181 ps\nMismatches: 408 in 436 samples\n"}
47
+ {"problem": "Prob047_dff8ar", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset should be asynchronous, but doesn't appear to be.\nHint: Output 'q' has 44 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 44 out of 436 samples\n\nSimulation finished at 2181 ps\nMismatches: 44 in 436 samples\n"}
48
+ {"problem": "Prob048_m2014_q4c", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 0 in 100 samples\n"}
49
+ {"problem": "Prob049_m2014_q4b", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 17 mismatches. First mismatch occurred at time 15.\nHint: Total mismatched samples is 17 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 17 in 100 samples\n"}
50
+ {"problem": "Prob050_kmap1", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 90 mismatches. First mismatch occurred at time 30.\nHint: Total mismatched samples is 90 out of 219 samples\n\nSimulation finished at 1096 ps\nMismatches: 90 in 219 samples\n"}
51
+ {"problem": "Prob051_gates4", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_and' has no mismatches.\nHint: Output 'out_or' has no mismatches.\nHint: Output 'out_xor' has no mismatches.\nHint: Total mismatched samples is 0 out of 234 samples\n\nSimulation finished at 1170 ps\nMismatches: 0 in 234 samples\n"}
52
+ {"problem": "Prob052_gates100", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_and' has no mismatches.\nHint: Output 'out_or' has no mismatches.\nHint: Output 'out_xor' has no mismatches.\nHint: Total mismatched samples is 0 out of 433 samples\n\nSimulation finished at 2166 ps\nMismatches: 0 in 433 samples\n"}
53
+ {"problem": "Prob053_m2014_q4d", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 1 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 1 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 1 in 100 samples\n"}
54
+ {"problem": "Prob054_edgedetect", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'pedge' has no mismatches.\nHint: Total mismatched samples is 0 out of 227 samples\n\nSimulation finished at 1135 ps\nMismatches: 0 in 227 samples\n"}
55
+ {"problem": "Prob055_conditional", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'min' has no mismatches.\nHint: Total mismatched samples is 0 out of 112 samples\n\nSimulation finished at 560 ps\nMismatches: 0 in 112 samples\n"}
56
+ {"problem": "Prob056_ece241_2013_q7", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'Q' has no mismatches.\nHint: Total mismatched samples is 0 out of 422 samples\n\nSimulation finished at 2110 ps\nMismatches: 0 in 422 samples\n"}
57
+ {"problem": "Prob057_kmap2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 123 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 123 out of 232 samples\n\nSimulation finished at 1161 ps\nMismatches: 123 in 232 samples\n"}
58
+ {"problem": "Prob058_alwaysblock2", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_assign' has no mismatches.\nHint: Output 'out_always_comb' has no mismatches.\nHint: Output 'out_always_ff' has no mismatches.\nHint: Total mismatched samples is 0 out of 219 samples\n\nSimulation finished at 1096 ps\nMismatches: 0 in 219 samples\n"}
59
+ {"problem": "Prob059_wire4", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'w' has no mismatches.\nHint: Output 'x' has no mismatches.\nHint: Output 'y' has no mismatches.\nHint: Output 'z' has no mismatches.\nHint: Total mismatched samples is 0 out of 218 samples\n\nSimulation finished at 1090 ps\nMismatches: 0 in 218 samples\n"}
60
+ {"problem": "Prob060_m2014_q4k", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 299 samples\n\nSimulation finished at 1496 ps\nMismatches: 0 in 299 samples\n"}
61
+ {"problem": "Prob061_2014_q4a", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'Q' has no mismatches.\nHint: Total mismatched samples is 0 out of 200 samples\n\nSimulation finished at 1001 ps\nMismatches: 0 in 200 samples\n"}
62
+ {"problem": "Prob062_bugs_mux2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 110 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 110 out of 114 samples\n\nSimulation finished at 570 ps\nMismatches: 110 in 114 samples\n"}
63
+ {"problem": "Prob063_review2015_shiftcount", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 2071 samples\n\nSimulation finished at 10356 ps\nMismatches: 0 in 2071 samples\n"}
64
+ {"problem": "Prob064_vector3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'w' has 100 mismatches. First mismatch occurred at time 130.\nHint: Output 'x' has 101 mismatches. First mismatch occurred at time 130.\nHint: Output 'y' has 115 mismatches. First mismatch occurred at time 60.\nHint: Output 'z' has 126 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 126 out of 126 samples\n\nSimulation finished at 630 ps\nMismatches: 126 in 126 samples\n"}
65
+ {"problem": "Prob065_7420", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'p1y' has no mismatches.\nHint: Output 'p2y' has no mismatches.\nHint: Total mismatched samples is 0 out of 239 samples\n\nSimulation finished at 1196 ps\nMismatches: 0 in 239 samples\n"}
66
+ {"problem": "Prob066_edgecapture", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 225 mismatches. First mismatch occurred at time 100.\nHint: Total mismatched samples is 225 out of 266 samples\n\nSimulation finished at 1330 ps\nMismatches: 225 in 266 samples\n"}
67
+ {"problem": "Prob067_countslow", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 499 samples\n\nSimulation finished at 2496 ps\nMismatches: 0 in 499 samples\n"}
68
+ {"problem": "Prob068_countbcd", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'ena' has 39634 mismatches. First mismatch occurred at time 160.\nHint: Output 'q' has 39756 mismatches. First mismatch occurred at time 30.\nHint: Total mismatched samples is 39774 out of 39805 samples\n\nSimulation finished at 199026 ps\nMismatches: 39774 in 39805 samples\n"}
69
+ {"problem": "Prob069_truthtable1", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'f' has 50 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 50 out of 58 samples\n\nSimulation finished at 290 ps\nMismatches: 50 in 58 samples\n"}
70
+ {"problem": "Prob070_ece241_2013_q2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_sop' has 36 mismatches. First mismatch occurred at time 20.\nHint: Output 'out_pos' has 27 mismatches. First mismatch occurred at time 30.\nHint: Total mismatched samples is 44 out of 107 samples\n\nSimulation finished at 535 ps\nMismatches: 44 in 107 samples\n"}
71
+ {"problem": "Prob071_always_casez", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'pos' has 1 mismatches. First mismatch occurred at time 1415.\nHint: Total mismatched samples is 1 out of 346 samples\n\nSimulation finished at 1730 ps\nMismatches: 1 in 346 samples\n"}
72
+ {"problem": "Prob072_thermostat", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'heater' has no mismatches.\nHint: Output 'aircon' has no mismatches.\nHint: Output 'fan' has no mismatches.\nHint: Total mismatched samples is 0 out of 248 samples\n\nSimulation finished at 1241 ps\nMismatches: 0 in 248 samples\n"}
73
+ {"problem": "Prob073_dff16e", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 443 samples\n\nSimulation finished at 2216 ps\nMismatches: 0 in 443 samples\n"}
74
+ {"problem": "Prob074_ece241_2014_q4", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 45 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 45 out of 118 samples\n\nSimulation finished at 590 ps\nMismatches: 45 in 118 samples\n"}
75
+ {"problem": "Prob075_counter_2bc", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'state' has no mismatches.\nHint: Total mismatched samples is 0 out of 1051 samples\n\nSimulation finished at 5256 ps\nMismatches: 0 in 1051 samples\n"}
76
+ {"problem": "Prob076_always_case", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 118 samples\n\nSimulation finished at 590 ps\nMismatches: 0 in 118 samples\n"}
77
+ {"problem": "Prob077_wire_decl", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Output 'out_n' has no mismatches.\nHint: Total mismatched samples is 0 out of 122 samples\n\nSimulation finished at 611 ps\nMismatches: 0 in 122 samples\n"}
78
+ {"problem": "Prob078_dualedge", "compile": false, "passed": false, "log": "dut.sv:2: syntax error\ndut.sv:2: Syntax in assignment statement l-value.\n"}
79
+ {"problem": "Prob079_fsm3onehot", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'next_state' has 141 mismatches. First mismatch occurred at time 10.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 141 out of 200 samples\n\nSimulation finished at 1001 ps\nMismatches: 141 in 200 samples\n"}
80
+ {"problem": "Prob080_timer", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'tc' has no mismatches.\nHint: Total mismatched samples is 0 out of 7127 samples\n\nSimulation finished at 35636 ps\nMismatches: 0 in 7127 samples\n"}
81
+ {"problem": "Prob081_7458", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'p1y' has no mismatches.\nHint: Output 'p2y' has no mismatches.\nHint: Total mismatched samples is 0 out of 439 samples\n\nSimulation finished at 2196 ps\nMismatches: 0 in 439 samples\n"}
82
+ {"problem": "Prob082_lfsr32", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nTIMEOUT\nHint: Output 'q' has 199953 mismatches. First mismatch occurred at time 190.\nHint: Total mismatched samples is 199953 out of 200000 samples\n\nSimulation finished at 1000000 ps\nMismatches: 199953 in 200000 samples\n"}
83
+ {"problem": "Prob083_mt2015_q4b", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has no mismatches.\nHint: Total mismatched samples is 0 out of 110 samples\n\nSimulation finished at 551 ps\nMismatches: 0 in 110 samples\n"}
84
+ {"problem": "Prob084_ece241_2013_q12", "compile": false, "passed": false, "log": "dut.sv:9: syntax error\ndut.sv:6: error: syntax error in continuous assignment\n"}
85
+ {"problem": "Prob085_shift4", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset should be asynchronous, but doesn't appear to be.\nHint: Output 'q' has 73 mismatches. First mismatch occurred at time 40.\nHint: Total mismatched samples is 73 out of 427 samples\n\nSimulation finished at 2136 ps\nMismatches: 73 in 427 samples\n"}
86
+ {"problem": "Prob086_lfsr5", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 4266 mismatches. First mismatch occurred at time 40.\nHint: Total mismatched samples is 4266 out of 4443 samples\n\nSimulation finished at 22216 ps\nMismatches: 4266 in 4443 samples\n"}
87
+ {"problem": "Prob087_gates", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_and' has no mismatches.\nHint: Output 'out_or' has no mismatches.\nHint: Output 'out_xor' has no mismatches.\nHint: Output 'out_nand' has no mismatches.\nHint: Output 'out_nor' has no mismatches.\nHint: Output 'out_xnor' has no mismatches.\nHint: Output 'out_anotb' has no mismatches.\nHint: Total mismatched samples is 0 out of 210 samples\n\nSimulation finished at 1050 ps\nMismatches: 0 in 210 samples\n"}
88
+ {"problem": "Prob088_ece241_2014_q5b", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset doesn't seem to be working.\nHint: Output 'z' has 436 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 436 out of 436 samples\n\nSimulation finished at 2180 ps\nMismatches: 436 in 436 samples\n"}
89
+ {"problem": "Prob089_ece241_2014_q5a", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 393 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 393 out of 436 samples\n\nSimulation finished at 2180 ps\nMismatches: 393 in 436 samples\n"}
90
+ {"problem": "Prob090_circuit1", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 120 samples\n\nSimulation finished at 600 ps\nMismatches: 0 in 120 samples\n"}
91
+ {"problem": "Prob091_2012_q2b", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'Y1' has 238 mismatches. First mismatch occurred at time 15.\nHint: Output 'Y3' has 325 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 443 out of 600 samples\n\nSimulation finished at 3001 ps\nMismatches: 443 in 600 samples\n"}
92
+ {"problem": "Prob092_gatesv100", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_both' has no mismatches.\nHint: Output 'out_any' has 201 mismatches. First mismatch occurred at time 5.\nHint: Output 'out_different' has no mismatches.\nHint: Total mismatched samples is 201 out of 201 samples\n\nSimulation finished at 1006 ps\nMismatches: 201 in 201 samples\n"}
93
+ {"problem": "Prob093_ece241_2014_q3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'mux_in' has 60 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 60 out of 60 samples\n\nSimulation finished at 300 ps\nMismatches: 60 in 60 samples\n"}
94
+ {"problem": "Prob094_gatesv", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_both' has 116 mismatches. First mismatch occurred at time 5.\nHint: Output 'out_any' has 109 mismatches. First mismatch occurred at time 5.\nHint: Output 'out_different' has 160 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 172 out of 213 samples\n\nSimulation finished at 1066 ps\nMismatches: 172 in 213 samples\n"}
95
+ {"problem": "Prob095_review2015_fsmshift", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'shift_ena' has no mismatches.\nHint: Total mismatched samples is 0 out of 200 samples\n\nSimulation finished at 1001 ps\nMismatches: 0 in 200 samples\n"}
96
+ {"problem": "Prob096_review2015_fsmseq", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'start_shifting' has 306 mismatches. First mismatch occurred at time 50.\nHint: Total mismatched samples is 306 out of 643 samples\n\nSimulation finished at 3216 ps\nMismatches: 306 in 643 samples\n"}
97
+ {"problem": "Prob097_mux9to1v", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 220 samples\n\nSimulation finished at 1100 ps\nMismatches: 0 in 220 samples\n"}
98
+ {"problem": "Prob098_circuit7", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 120 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 120 out of 123 samples\n\nSimulation finished at 615 ps\nMismatches: 120 in 123 samples\n"}
99
+ {"problem": "Prob099_m2014_q6c", "compile": false, "passed": false, "log": "test.sv:71: error: port ``Y2'' is not a port of good1.\ntest.sv:71: error: port ``Y4'' is not a port of good1.\ntest.sv:77: error: port ``Y2'' is not a port of top_module1.\ntest.sv:77: error: port ``Y4'' is not a port of top_module1.\n4 error(s) during elaboration.\n"}
100
+ {"problem": "Prob100_fsm3comb", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'next_state' has 70 mismatches. First mismatch occurred at time 10.\nHint: Output 'out' has 14 mismatches. First mismatch occurred at time 40.\nHint: Total mismatched samples is 70 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 70 in 100 samples\n"}
101
+ {"problem": "Prob101_circuit4", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 53 mismatches. First mismatch occurred at time 25.\nHint: Total mismatched samples is 53 out of 121 samples\n\nSimulation finished at 605 ps\nMismatches: 53 in 121 samples\n"}
102
+ {"problem": "Prob102_circuit3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 64 mismatches. First mismatch occurred at time 25.\nHint: Total mismatched samples is 64 out of 121 samples\n\nSimulation finished at 605 ps\nMismatches: 64 in 121 samples\n"}
103
+ {"problem": "Prob103_circuit2", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 121 samples\n\nSimulation finished at 605 ps\nMismatches: 0 in 121 samples\n"}
104
+ {"problem": "Prob104_mt2015_muxdff", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'Q' has 1 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 1 out of 199 samples\n\nSimulation finished at 996 ps\nMismatches: 1 in 199 samples\n"}
105
+ {"problem": "Prob105_rotate100", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 3292 mismatches. First mismatch occurred at time 60.\nHint: Total mismatched samples is 3292 out of 4005 samples\n\nSimulation finished at 20026 ps\nMismatches: 3292 in 4005 samples\n"}
106
+ {"problem": "Prob106_always_nolatches", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'left' has no mismatches.\nHint: Output 'down' has no mismatches.\nHint: Output 'right' has no mismatches.\nHint: Output 'up' has no mismatches.\nHint: Total mismatched samples is 0 out of 30020 samples\n\nSimulation finished at 150100 ps\nMismatches: 0 in 30020 samples\n"}
107
+ {"problem": "Prob107_fsm1s", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 137 mismatches. First mismatch occurred at time 30.\nHint: Total mismatched samples is 137 out of 230 samples\n\nSimulation finished at 1151 ps\nMismatches: 137 in 230 samples\n"}
108
+ {"problem": "Prob108_rule90", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 6022 mismatches. First mismatch occurred at time 50.\nHint: Total mismatched samples is 6022 out of 7121 samples\n\nSimulation finished at 35606 ps\nMismatches: 6022 in 7121 samples\n"}
109
+ {"problem": "Prob109_fsm1", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 228 samples\n\nSimulation finished at 1141 ps\nMismatches: 0 in 228 samples\n"}
110
+ {"problem": "Prob110_fsm2", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 241 samples\n\nSimulation finished at 1206 ps\nMismatches: 0 in 241 samples\n"}
111
+ {"problem": "Prob111_fsm2s", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Total mismatched samples is 0 out of 241 samples\n\nSimulation finished at 1206 ps\nMismatches: 0 in 241 samples\n"}
112
+ {"problem": "Prob112_always_case2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'pos' has 61 mismatches. First mismatch occurred at time 90.\nHint: Total mismatched samples is 61 out of 94 samples\n\nSimulation finished at 470 ps\nMismatches: 61 in 94 samples\n"}
113
+ {"problem": "Prob113_2012_q1g", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'f' has 30 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 30 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 30 in 100 samples\n"}
114
+ {"problem": "Prob114_bugs_case", "compile": false, "passed": false, "log": "dut.sv:4: syntax error\ndut.sv:5: error: Incomprehensible case expression.\ndut.sv:5: syntax error\ndut.sv:6: error: Incomprehensible case expression.\ndut.sv:6: syntax error\ndut.sv:7: error: Incomprehensible case expression.\ndut.sv:7: syntax error\ndut.sv:8: error: Incomprehensible case expression.\ndut.sv:8: syntax error\ndut.sv:9: error: Incomprehensible case expression.\ndut.sv:9: syntax error\ndut.sv:10: error: Incomprehensible case expression.\ndut.sv:10: syntax error\ndut.sv:11: error: Incomprehensible case expression.\ndut.sv:11: syntax error\ndut.sv:12: error: Incomprehensible case expression.\ndut.sv:12: syntax error\ndut.sv:13: error: Incomprehensible case expression.\ndut.sv:13: syntax error\ndut.sv:14: error: Incomprehensible case expression.\n"}
115
+ {"problem": "Prob115_shift18", "compile": false, "passed": false, "log": "dut.sv:8: warning: extra digits given for sized binary constant.\ndut.sv:8: syntax error\ndut.sv:8: error: malformed statement\n"}
116
+ {"problem": "Prob116_m2014_q3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'f' has 40 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 40 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 40 in 100 samples\n"}
117
+ {"problem": "Prob117_circuit9", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 244 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 244 out of 245 samples\n\nSimulation finished at 1225 ps\nMismatches: 244 in 245 samples\n"}
118
+ {"problem": "Prob118_history_shift", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'predict_history' has 980 mismatches. First mismatch occurred at time 220.\nHint: Total mismatched samples is 980 out of 2055 samples\n\nSimulation finished at 10276 ps\nMismatches: 980 in 2055 samples\n"}
119
+ {"problem": "Prob119_fsm3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 56 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 56 out of 230 samples\n\nSimulation finished at 1151 ps\nMismatches: 56 in 230 samples\n"}
120
+ {"problem": "Prob120_fsm3s", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 56 mismatches. First mismatch occurred at time 40.\nHint: Total mismatched samples is 56 out of 230 samples\n\nSimulation finished at 1151 ps\nMismatches: 56 in 230 samples\n"}
121
+ {"problem": "Prob121_2014_q3bfsm", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 516 mismatches. First mismatch occurred at time 30.\nHint: Total mismatched samples is 516 out of 1006 samples\n\nSimulation finished at 5031 ps\nMismatches: 516 in 1006 samples\n"}
122
+ {"problem": "Prob122_kmap4", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 142 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 142 out of 232 samples\n\nSimulation finished at 1161 ps\nMismatches: 142 in 232 samples\n"}
123
+ {"problem": "Prob123_bugs_addsubz", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has no mismatches.\nHint: Output 'result_is_zero' has no mismatches.\nHint: Total mismatched samples is 0 out of 118 samples\n\nSimulation finished at 590 ps\nMismatches: 0 in 118 samples\n"}
124
+ {"problem": "Prob124_rule110", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 6220 mismatches. First mismatch occurred at time 40.\nHint: Total mismatched samples is 6220 out of 6283 samples\n\nSimulation finished at 31416 ps\nMismatches: 6220 in 6283 samples\n"}
125
+ {"problem": "Prob125_kmap3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out' has 124 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 124 out of 232 samples\n\nSimulation finished at 1161 ps\nMismatches: 124 in 232 samples\n"}
126
+ {"problem": "Prob126_circuit6", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has no mismatches.\nHint: Total mismatched samples is 0 out of 113 samples\n\nSimulation finished at 565 ps\nMismatches: 0 in 113 samples\n"}
127
+ {"problem": "Prob127_lemmings1", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset doesn't seem to be working.\nHint: Output 'walk_left' has 133 mismatches. First mismatch occurred at time 5.\nHint: Output 'walk_right' has 137 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 205 out of 229 samples\n\nSimulation finished at 1146 ps\nMismatches: 205 in 229 samples\n"}
128
+ {"problem": "Prob128_fsm_ps2", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'done' has no mismatches.\nHint: Total mismatched samples is 0 out of 400 samples\n\nSimulation finished at 2001 ps\nMismatches: 0 in 400 samples\n"}
129
+ {"problem": "Prob129_ece241_2013_q8", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 287 mismatches. First mismatch occurred at time 5.\nHint: Total mismatched samples is 287 out of 440 samples\n\nSimulation finished at 2200 ps\nMismatches: 287 in 440 samples\n"}
130
+ {"problem": "Prob130_circuit5", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 40 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 40 out of 141 samples\n\nSimulation finished at 705 ps\nMismatches: 40 in 141 samples\n"}
131
+ {"problem": "Prob131_mt2015_q4", "compile": false, "passed": false, "log": "test.sv:68: error: Unknown module type: TopModule\n2 error(s) during elaboration.\n*** These modules were missing:\n TopModule referenced 1 times.\n***\n"}
132
+ {"problem": "Prob132_always_if2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'shut_off_computer' has no mismatches.\nHint: Output 'keep_driving' has 41 mismatches. First mismatch occurred at time 30.\nHint: Total mismatched samples is 41 out of 121 samples\n\nSimulation finished at 605 ps\nMismatches: 41 in 121 samples\n"}
133
+ {"problem": "Prob133_2014_q3fsm", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 174 mismatches. First mismatch occurred at time 80.\nHint: Total mismatched samples is 174 out of 1414 samples\n\nSimulation finished at 7071 ps\nMismatches: 174 in 1414 samples\n"}
134
+ {"problem": "Prob134_2014_q3c", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'Y0' has 67 mismatches. First mismatch occurred at time 10.\nHint: Output 'z' has 22 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 78 out of 200 samples\n\nSimulation finished at 1001 ps\nMismatches: 78 in 200 samples\n"}
135
+ {"problem": "Prob135_m2014_q6b", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'Y1' has 27 mismatches. First mismatch occurred at time 20.\nHint: Total mismatched samples is 27 out of 100 samples\n\nSimulation finished at 501 ps\nMismatches: 27 in 100 samples\n"}
136
+ {"problem": "Prob136_m2014_q6", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 76 mismatches. First mismatch occurred at time 230.\nHint: Total mismatched samples is 76 out of 200 samples\n\nSimulation finished at 1001 ps\nMismatches: 76 in 200 samples\n"}
137
+ {"problem": "Prob137_fsm_serial", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'done' has 166 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 166 out of 905 samples\n\nSimulation finished at 4526 ps\nMismatches: 166 in 905 samples\n"}
138
+ {"problem": "Prob138_2012_q2fsm", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'z' has 88 mismatches. First mismatch occurred at time 210.\nHint: Total mismatched samples is 88 out of 400 samples\n\nSimulation finished at 2001 ps\nMismatches: 88 in 400 samples\n"}
139
+ {"problem": "Prob139_2013_q2bfsm", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'f' has 312 mismatches. First mismatch occurred at time 20.\nHint: Output 'g' has 514 mismatches. First mismatch occurred at time 60.\nHint: Total mismatched samples is 663 out of 1002 samples\n\nSimulation finished at 5011 ps\nMismatches: 663 in 1002 samples\n"}
140
+ {"problem": "Prob140_fsm_hdlc", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'disc' has 98 mismatches. First mismatch occurred at time 70.\nHint: Output 'flag' has 82 mismatches. First mismatch occurred at time 80.\nHint: Output 'err' has 210 mismatches. First mismatch occurred at time 90.\nHint: Total mismatched samples is 328 out of 801 samples\n\nSimulation finished at 4006 ps\nMismatches: 328 in 801 samples\n"}
141
+ {"problem": "Prob141_count_clock", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset doesn't seem to be working.\nHint: Clock seems to reset to 00:x0:x0 AM (Should be 12:00:00 AM).\nTIMEOUT\nHint: Output 'pm' has 86400 mismatches. First mismatch occurred at time 434270.\nHint: Output 'hh' has 199999 mismatches. First mismatch occurred at time 10.\nHint: Output 'mm' has 199999 mismatches. First mismatch occurred at time 10.\nHint: Output 'ss' has 199999 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 199999 out of 200000 samples\n\nSimulation finished at 1000000 ps\nMismatches: 199999 in 200000 samples\n"}
142
+ {"problem": "Prob142_lemmings2", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset doesn't seem to be working.\nHint: Output 'walk_left' has 235 mismatches. First mismatch occurred at time 5.\nHint: Output 'walk_right' has 165 mismatches. First mismatch occurred at time 110.\nHint: Output 'aaah' has 78 mismatches. First mismatch occurred at time 100.\nHint: Total mismatched samples is 441 out of 441 samples\n\nSimulation finished at 2206 ps\nMismatches: 441 in 441 samples\n"}
143
+ {"problem": "Prob143_fsm_onehot", "compile": false, "passed": false, "log": "dut.sv:6: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:6: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:10: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:10: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:14: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:14: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:18: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:18: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:22: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:22: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:26: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:26: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:30: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:30: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:34: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:34: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:38: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:38: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\ndut.sv:42: error: out1 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out1 is declared here as wire.\ndut.sv:42: error: out2 is not a valid l-value in tb.top_module1.\ndut.sv:1: : out2 is declared here as wire.\n20 error(s) during elaboration.\n"}
144
+ {"problem": "Prob144_conwaylife", "compile": false, "passed": false, "log": "dut.sv:13: syntax error\ndut.sv:13: error: malformed statement\n"}
145
+ {"problem": "Prob145_circuit8", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'p' has 112 mismatches. First mismatch occurred at time 90.\nHint: Output 'q' has 133 mismatches. First mismatch occurred at time 120.\nHint: Total mismatched samples is 173 out of 240 samples\n\nSimulation finished at 1200 ps\nMismatches: 173 in 240 samples\n"}
146
+ {"problem": "Prob146_fsm_serialdata", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_byte' has 32 mismatches. First mismatch occurred at time 850.\nHint: Output 'done' has 200 mismatches. First mismatch occurred at time 320.\nHint: Total mismatched samples is 226 out of 905 samples\n\nSimulation finished at 4526 ps\nMismatches: 226 in 905 samples\n"}
147
+ {"problem": "Prob147_circuit10", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'q' has 12 mismatches. First mismatch occurred at time 50.\nHint: Output 'state' has 6 mismatches. First mismatch occurred at time 60.\nHint: Total mismatched samples is 16 out of 232 samples\n\nSimulation finished at 1160 ps\nMismatches: 16 in 232 samples\n"}
148
+ {"problem": "Prob148_2013_q2afsm", "compile": true, "passed": true, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'g' has no mismatches.\nHint: Total mismatched samples is 0 out of 1054 samples\n\nSimulation finished at 5271 ps\nMismatches: 0 in 1054 samples\n"}
149
+ {"problem": "Prob149_ece241_2013_q4", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Your reset doesn't seem to be working.\nHint: Output 'fr2' has 860 mismatches. First mismatch occurred at time 90.\nHint: Output 'fr1' has 1462 mismatches. First mismatch occurred at time 30.\nHint: Output 'fr0' has 2031 mismatches. First mismatch occurred at time 30.\nHint: Output 'dfr' has 1240 mismatches. First mismatch occurred at time 10.\nHint: Total mismatched samples is 2039 out of 2040 samples\n\nSimulation finished at 10200 ps\nMismatches: 2039 in 2040 samples\n"}
150
+ {"problem": "Prob150_review2015_fsmonehot", "compile": false, "passed": false, "log": "dut.sv:34: warning: Numeric constant truncated to 10 bits.\ndut.sv:37: warning: Numeric constant truncated to 10 bits.\ndut.sv:40: warning: Numeric constant truncated to 10 bits.\ndut.sv:43: warning: Numeric constant truncated to 10 bits.\ndut.sv:26: error: Could not find variable ``B0_next'' in ``tb.top_module1''\ndut.sv:29: error: shift_ena is not a valid l-value in tb.top_module1.\ndut.sv:1: : shift_ena is declared here as wire.\ndut.sv:29: error: Could not find variable ``B1_next'' in ``tb.top_module1''\ndut.sv:32: error: shift_ena is not a valid l-value in tb.top_module1.\ndut.sv:1: : shift_ena is declared here as wire.\ndut.sv:32: error: Could not find variable ``B2_next'' in ``tb.top_module1''\ndut.sv:35: error: shift_ena is not a valid l-value in tb.top_module1.\ndut.sv:1: : shift_ena is declared here as wire.\ndut.sv:38: error: counting is not a valid l-value in tb.top_module1.\ndut.sv:1: : counting is declared here as wire.\ndut.sv:41: error: counting is not a valid l-value in tb.top_module1.\ndut.sv:1: : counting is declared here as wire.\ndut.sv:44: error: done is not a valid l-value in tb.top_module1.\ndut.sv:1: : done is declared here as wire.\n9 error(s) during elaboration.\n"}
151
+ {"problem": "Prob151_review2015_fsm", "compile": false, "passed": false, "log": "ref.sv:21: sorry: This cast operation is not yet supported.\nref.sv:22: sorry: This cast operation is not yet supported.\nref.sv:23: sorry: This cast operation is not yet supported.\nref.sv:24: sorry: This cast operation is not yet supported.\nref.sv:29: sorry: This cast operation is not yet supported.\nref.sv:30: sorry: This cast operation is not yet supported.\nref.sv:31: sorry: This cast operation is not yet supported.\n7 error(s) during elaboration.\n"}
152
+ {"problem": "Prob152_lemmings3", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'walk_left' has 94 mismatches. First mismatch occurred at time 5.\nHint: Output 'walk_right' has 253 mismatches. First mismatch occurred at time 5.\nHint: Output 'aaah' has 65 mismatches. First mismatch occurred at time 150.\nHint: Output 'digging' has 203 mismatches. First mismatch occurred at time 120.\nHint: Total mismatched samples is 310 out of 443 samples\n\nSimulation finished at 2216 ps\nMismatches: 310 in 443 samples\n"}
153
+ {"problem": "Prob153_gshare", "compile": false, "passed": false, "log": "dut.sv:6: syntax error\ndut.sv:6: error: malformed statement\n"}
154
+ {"problem": "Prob154_fsm_ps2data", "compile": true, "passed": false, "log": "VCD info: dumpfile wave.vcd opened for output.\nHint: Output 'out_bytes' has 490 mismatches. First mismatch occurred at time 210.\nHint: Output 'done' has 730 mismatches. First mismatch occurred at time 210.\nHint: Total mismatched samples is 946 out of 1619 samples\n\nSimulation finished at 8096 ps\nMismatches: 946 in 1619 samples\n"}
155
+ {"problem": "Prob155_lemmings4", "compile": false, "passed": false, "log": "dut.sv:31: warning: Numeric constant truncated to 4 bits.\ndut.sv:5: error: Unable to bind wire/reg/memory `state_change' in `tb.top_module1'\ndut.sv:5: error: Failed to evaluate event expression 'state_change'.\n2 error(s) during elaboration.\n"}
156
+ {"problem": "Prob156_review2015_fancytimer", "compile": false, "passed": false, "log": "ref.sv:25: sorry: This cast operation is not yet supported.\nref.sv:26: sorry: This cast operation is not yet supported.\nref.sv:27: sorry: This cast operation is not yet supported.\nref.sv:28: sorry: This cast operation is not yet supported.\nref.sv:33: sorry: This cast operation is not yet supported.\nref.sv:34: sorry: This cast operation is not yet supported.\nref.sv:35: sorry: This cast operation is not yet supported.\n7 error(s) during elaboration.\n"}
qwen25-coder-7b-verilog-delta-distilled-lora/scripts/build_v30b_delta_distill_dataset.py ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build v30b delta-distillation dataset.
3
+
4
+ Purpose: make a *single* adapter beat v9 by focusing training pressure on the
5
+ small delta where v9 fails but v29 verifier-selector passes, while retaining
6
+ v9/general Verilog behavior.
7
+
8
+ Main signal:
9
+ - delta_wins: v29 selector passed and v9 direct did not pass.
10
+
11
+ Retention:
12
+ - v9 passed outputs.
13
+ - clean/manual verified non-reference rows.
14
+ - hand-written paper/robust-style functional rows verified with iverilog.
15
+ - small verified synthetic rows from v29 gate data.
16
+
17
+ Caveat: delta rows are benchmark-targeted distilled outputs, not clean zero-shot
18
+ leaderboard evidence.
19
+ """
20
+ import argparse
21
+ import hashlib
22
+ import json
23
+ import random
24
+ import shutil
25
+ import subprocess
26
+ import sys
27
+ import tempfile
28
+ from pathlib import Path
29
+
30
+ ROOT = Path(__file__).resolve().parents[1]
31
+ if str(ROOT) not in sys.path:
32
+ sys.path.insert(0, str(ROOT))
33
+
34
+ CLEAN_INPUTS = [
35
+ "teacher_solutions/formatted_benchmarks/clean_or_verified_non_reference_seeded.jsonl",
36
+ "teacher_solutions/formatted_benchmarks/manual_clean_verilogeval.jsonl",
37
+ "teacher_solutions/manual_clean_verilogeval_v1_codecomplete/solutions_all.jsonl",
38
+ "teacher_solutions/formatted_benchmarks/rtllm_ir_verified.jsonl",
39
+ "teacher_solutions/formatted_benchmarks/paper_style_internal.jsonl",
40
+ "data/v15_clean_multibench_teacher_direct.jsonl",
41
+ ]
42
+ CATEGORIES = ["comb_vector", "counter_timer", "seq_shift", "case_kmap", "fsm_protocol", "arith_datapath", "other"]
43
+
44
+
45
+ def read_jsonl(path):
46
+ path = Path(path)
47
+ if not path.exists():
48
+ return []
49
+ out = []
50
+ for line in path.read_text(errors="ignore").splitlines():
51
+ if line.strip():
52
+ try:
53
+ out.append(json.loads(line))
54
+ except json.JSONDecodeError:
55
+ pass
56
+ return out
57
+
58
+
59
+ def digest(row):
60
+ return hashlib.sha256((row.get("spec", "") + "\n---\n" + row.get("code", "")).encode()).hexdigest()
61
+
62
+
63
+ def classify(problem="", spec="", category="", code=""):
64
+ text = " ".join([problem or "", spec or "", category or "", code[:400] or ""]).lower()
65
+ if any(k in text for k in ["fsm", "state machine", "lemmings", "ps/2", "ps2", "serial", "hdlc", "protocol", "sequence detector", "traffic", "vending"]):
66
+ return "fsm_protocol"
67
+ if any(k in text for k in ["counter", "count", "timer", "clock", "bcd", "modulo", "period", "pulse", "pwm", "crc"]):
68
+ return "counter_timer"
69
+ if any(k in text for k in ["dff", "flip-flop", "flip flop", "edge", "shift", "rotate", "lfsr", "rule90", "rule110", "history", "gshare", "register"]):
70
+ return "seq_shift"
71
+ if any(k in text for k in ["kmap", "k-map", "truth", "minterm", "casez", "casex", "priority", "encoder", "decoder", "popcount", "leading_one"]):
72
+ return "case_kmap"
73
+ if any(k in text for k in ["adder", "add", "subtract", "sum", "carry", "overflow", "alu", "multiply", "divide", "signed", "saturat", "compare", "arithmetic", "abs_value"]):
74
+ return "arith_datapath"
75
+ if any(k in text for k in ["mux", "vector", "bitwise", "gate", "circuit", "wire", "reduction", "xor", "and", "or", "not", "ram", "regfile"]):
76
+ return "comb_vector"
77
+ return "other"
78
+
79
+
80
+ def norm(row, source, role, max_chars, forced_cat=None):
81
+ spec = (row.get("spec") or row.get("prompt") or "").strip()
82
+ code = (row.get("code") or row.get("solution") or "").strip()
83
+ if not spec or not code or "module" not in code.lower() or "endmodule" not in code.lower():
84
+ return None
85
+ if row.get("used_reference_as_solution", False):
86
+ return None
87
+ if len(spec) + len(code) > max_chars:
88
+ return None
89
+ cat = forced_cat or row.get("v30_category") or row.get("v29_category") or classify(row.get("problem", ""), spec, row.get("category", ""), code)
90
+ return {
91
+ "spec": spec,
92
+ "code": code + "\n",
93
+ "problem": row.get("problem"),
94
+ "benchmark": row.get("benchmark", "unknown"),
95
+ "source": source,
96
+ "verified": bool(row.get("verified", True)),
97
+ "used_reference_as_solution": False,
98
+ "used_adapter": bool(row.get("used_adapter", False)),
99
+ "v30b_role": role,
100
+ "v30b_category": cat,
101
+ }
102
+
103
+
104
+ def prompt_for(repo, problem):
105
+ for sub in ["dataset_spec-to-rtl", "dataset_code-complete-iccad2023"]:
106
+ p = Path(repo) / sub / f"{problem}_prompt.txt"
107
+ if p.exists():
108
+ return p.read_text(errors="ignore").strip()
109
+ return ""
110
+
111
+
112
+ def collect_selected_outputs(repo, selector_build, v9_build, max_chars):
113
+ repo = Path(repo); selector_build = Path(selector_build); v9_build = Path(v9_build)
114
+ v9 = {r.get("problem"): r for r in read_jsonl(v9_build / "direct_summary_results.jsonl")}
115
+ selector_rows, delta_rows = [], []
116
+ for rec in read_jsonl(selector_build / "direct_summary_results.jsonl"):
117
+ if not rec.get("passed"):
118
+ continue
119
+ problem = rec.get("problem")
120
+ spec = prompt_for(repo, problem)
121
+ code_path = selector_build / problem / f"{problem}_sample01.sv"
122
+ if not spec or not code_path.exists():
123
+ continue
124
+ raw = {"spec": spec, "code": code_path.read_text(errors="ignore"), "problem": problem, "benchmark": "VerilogEval_v2", "verified": True, "used_adapter": True}
125
+ is_delta = not bool(v9.get(problem, {}).get("passed"))
126
+ role = "delta_v9_fail_v29_pass" if is_delta else "selector_pass_retention"
127
+ row = norm(raw, "v30b_v29_selector_pass", role, max_chars, forced_cat=rec.get("category"))
128
+ if row:
129
+ row["selected_adapter"] = rec.get("selected_adapter")
130
+ selector_rows.append(row)
131
+ if is_delta:
132
+ delta_rows.append(row)
133
+ return selector_rows, delta_rows
134
+
135
+
136
+ def collect_v9_pass(repo, v9_build, max_chars):
137
+ repo = Path(repo); v9_build = Path(v9_build)
138
+ rows = []
139
+ for rec in read_jsonl(v9_build / "direct_summary_results.jsonl"):
140
+ if not rec.get("passed"):
141
+ continue
142
+ problem = rec.get("problem")
143
+ spec = prompt_for(repo, problem)
144
+ code_path = v9_build / problem / f"{problem}_sample01.sv"
145
+ if not spec or not code_path.exists():
146
+ continue
147
+ raw = {"spec": spec, "code": code_path.read_text(errors="ignore"), "problem": problem, "benchmark": "VerilogEval_v2", "verified": True, "used_adapter": True}
148
+ r = norm(raw, "v30b_v9_pass_retention", "v9_pass_retention", max_chars)
149
+ if r:
150
+ rows.append(r)
151
+ return rows
152
+
153
+
154
+ def collect_clean(max_chars):
155
+ rows, seen = [], set()
156
+ for path in CLEAN_INPUTS:
157
+ for raw in read_jsonl(path):
158
+ r = norm(raw, f"v30b_clean:{path}", "clean_verified_retention", max_chars)
159
+ if not r or not r.get("verified", True):
160
+ continue
161
+ key = digest(r)
162
+ if key in seen:
163
+ continue
164
+ seen.add(key)
165
+ rows.append(r)
166
+ return rows
167
+
168
+
169
+ def collect_synth(path, per_cat, seed, max_chars):
170
+ rng = random.Random(seed)
171
+ by = {c: [] for c in CATEGORIES}
172
+ seen = set()
173
+ for raw in read_jsonl(path):
174
+ src = str(raw.get("source", "")).lower()
175
+ bench = str(raw.get("benchmark", "")).lower()
176
+ if "synthetic" not in src and "synthetic" not in bench:
177
+ continue
178
+ if raw.get("verified") is False:
179
+ continue
180
+ r = norm(raw, "v30b_small_verified_synthetic", "small_verified_synthetic", max_chars)
181
+ if not r:
182
+ continue
183
+ key = digest(r)
184
+ if key in seen:
185
+ continue
186
+ seen.add(key)
187
+ by.setdefault(r["v30b_category"], []).append(r)
188
+ rows = []
189
+ for c, rs in by.items():
190
+ rng.shuffle(rs)
191
+ rows.extend(rs[:per_cat])
192
+ rng.shuffle(rows)
193
+ return rows
194
+
195
+
196
+ def run_iverilog_ok(code, tb):
197
+ if not shutil.which("iverilog"):
198
+ return True
199
+ with tempfile.TemporaryDirectory() as td:
200
+ td = Path(td)
201
+ (td / "dut.v").write_text(code)
202
+ cmd = ["iverilog", "-g2012", "-o", str(td / "sim.out"), str(td / "dut.v")]
203
+ if tb:
204
+ (td / "tb.v").write_text(tb)
205
+ cmd.append(str(td / "tb.v"))
206
+ try:
207
+ c = subprocess.run(cmd, capture_output=True, text=True, timeout=20)
208
+ if c.returncode:
209
+ return False
210
+ if not tb:
211
+ return True
212
+ v = subprocess.run([str(td / "sim.out")], capture_output=True, text=True, timeout=20)
213
+ txt = v.stdout + v.stderr
214
+ return v.returncode == 0 and "PASS" in txt and "FAIL" not in txt
215
+ except subprocess.TimeoutExpired:
216
+ return False
217
+
218
+
219
+ def paper_repair_rows(max_chars):
220
+ # Hand-written external rows for general RTL skills. Testbenches come from paper-style harness.
221
+ try:
222
+ from src.paper_style_verilog_benchmark import TASKS
223
+ except Exception:
224
+ TASKS = []
225
+ code = {
226
+ "comb_half_adder": "module half_adder(input a, input b, output sum, output carry); assign sum = a ^ b; assign carry = a & b; endmodule",
227
+ "comb_full_adder": "module full_adder(input a, input b, input cin, output sum, output cout); assign {cout,sum} = a + b + cin; endmodule",
228
+ "comb_mux4": "module mux4to1(input [7:0] a,b,c,d, input [1:0] sel, output reg [7:0] y); always @(*) begin case(sel) 2'd0:y=a; 2'd1:y=b; 2'd2:y=c; default:y=d; endcase end endmodule",
229
+ "comb_decoder": "module decoder_3to8(input [2:0] in, output [7:0] out); assign out = 8'b1 << in; endmodule",
230
+ "comb_priority": "module priority_encoder_8to3(input [7:0] in, output reg [2:0] out, output valid); assign valid = |in; always @(*) begin out=0; if(in[7]) out=7; else if(in[6]) out=6; else if(in[5]) out=5; else if(in[4]) out=4; else if(in[3]) out=3; else if(in[2]) out=2; else if(in[1]) out=1; else out=0; end endmodule",
231
+ "comb_comparator": "module comparator_8bit(input [7:0] a, input [7:0] b, output eq, output gt, output lt); assign eq=(a==b); assign gt=(a>b); assign lt=(a<b); endmodule",
232
+ "comb_parity_explicit": "module parity_generator(input [7:0] data, output even_parity, output odd_parity); assign even_parity = ^data; assign odd_parity = ~(^data); endmodule",
233
+ "arith_alu4": "module alu_4bit(input [3:0] a, input [3:0] b, input [2:0] op, output reg [3:0] y, output zero); always @(*) begin case(op) 3'd0:y=a+b; 3'd1:y=a-b; 3'd2:y=a&b; 3'd3:y=a|b; 3'd4:y=a^b; default:y=0; endcase end assign zero=(y==0); endmodule",
234
+ "arith_satadd": "module sat_adder8(input signed [7:0] a, input signed [7:0] b, output reg signed [7:0] sum); reg signed [8:0] tmp; always @(*) begin tmp = a + b; if(tmp > 9'sd127) sum = 8'sd127; else if(tmp < -9'sd128) sum = -8'sd128; else sum = tmp[7:0]; end endmodule",
235
+ "arith_abs": "module abs_value_8bit(input signed [7:0] in, output [7:0] out); assign out = in[7] ? -in : in; endmodule",
236
+ "bit_rotate_left": "module rotate_left_8(input [7:0] data, input [2:0] shamt, output [7:0] out); assign out = (data << shamt) | (data >> (8-shamt)); endmodule",
237
+ "bit_barrel": "module barrel_shifter_8bit(input [7:0] data, input [2:0] shamt, input dir, output [7:0] out); assign out = dir ? (data >> shamt) : (data << shamt); endmodule",
238
+ "bit_gray": "module binary_to_gray(input [3:0] bin, output [3:0] gray); assign gray = bin ^ (bin >> 1); endmodule",
239
+ "bit_lod": "module leading_one_detector(input [7:0] in, output reg [2:0] pos, output valid); assign valid=|in; always @(*) begin pos=0; if(in[7]) pos=7; else if(in[6]) pos=6; else if(in[5]) pos=5; else if(in[4]) pos=4; else if(in[3]) pos=3; else if(in[2]) pos=2; else if(in[1]) pos=1; else pos=0; end endmodule",
240
+ "seq_dff_sync": "module dff_sync_reset(input clk, input rst, input d, output reg q); always @(posedge clk) begin if(rst) q <= 1'b0; else q <= d; end endmodule",
241
+ "seq_dff_async": "module dff_async_reset(input clk, input rst, input d, output reg q); always @(posedge clk or posedge rst) begin if(rst) q <= 1'b0; else q <= d; end endmodule",
242
+ "seq_counter": "module counter_8bit_up(input clk, input rst, input en, output reg [7:0] count); always @(posedge clk) begin if(rst) count <= 0; else if(en) count <= count + 1'b1; end endmodule",
243
+ "seq_shiftreg": "module shift_register_8(input clk, input rst, input serial_in, output reg [7:0] data); always @(posedge clk) begin if(rst) data <= 8'b0; else data <= {data[6:0], serial_in}; end endmodule",
244
+ "seq_edge": "module rising_edge_detector(input clk, input rst, input signal_in, output reg pulse); reg prev; always @(posedge clk) begin if(rst) begin prev <= 0; pulse <= 0; end else begin pulse <= signal_in & ~prev; prev <= signal_in; end end endmodule",
245
+ "fsm_1011_overlap": "module sequence_detector_1011(input clk, input rst, input bit_in, output reg detected); reg [2:0] state; localparam S0=0,S1=1,S10=2,S101=3; always @(posedge clk) begin if(rst) begin state<=S0; detected<=0; end else begin detected<=0; case(state) S0: state <= bit_in ? S1 : S0; S1: state <= bit_in ? S1 : S10; S10: state <= bit_in ? S101 : S0; S101: begin if(bit_in) begin detected<=1; state<=S1; end else state<=S10; end default: state<=S0; endcase end end endmodule",
246
+ "mem_regfile": "module register_file_32x32(input clk, input we, input [4:0] rd_addr1, input [4:0] rd_addr2, input [4:0] wr_addr, input [31:0] wr_data, output [31:0] rd_data1, output [31:0] rd_data2); reg [31:0] regs[31:0]; integer i; initial begin for(i=0;i<32;i=i+1) regs[i]=0; end always @(posedge clk) begin if(we && wr_addr!=0) regs[wr_addr] <= wr_data; regs[0] <= 0; end assign rd_data1 = (rd_addr1==0) ? 32'b0 : regs[rd_addr1]; assign rd_data2 = (rd_addr2==0) ? 32'b0 : regs[rd_addr2]; endmodule",
247
+ "mem_ram16": "module ram_16x8(input clk, input we, input [3:0] addr, input [7:0] din, output [7:0] dout); reg [7:0] mem[0:15]; always @(posedge clk) begin if(we) mem[addr] <= din; end assign dout = mem[addr]; endmodule",
248
+ }
249
+ rows = []
250
+ tasks = {t["id"]: t for t in TASKS}
251
+ for tid, c in code.items():
252
+ t = tasks.get(tid)
253
+ if not t:
254
+ continue
255
+ tb = t.get("testbench")
256
+ if run_iverilog_ok(c, tb):
257
+ raw = {"spec": t["prompt"], "code": c, "problem": tid, "benchmark": "paper_style_internal_repair", "verified": True, "used_adapter": False}
258
+ r = norm(raw, "v30b_paper_style_functional_rows", "external_functional_repair", max_chars, forced_cat=classify(tid, t["prompt"], t.get("category", ""), c))
259
+ if r:
260
+ rows.append(r)
261
+ return rows
262
+
263
+
264
+ def repeat(rows, n, tag):
265
+ out = []
266
+ for r in rows:
267
+ for i in range(n):
268
+ rr = dict(r)
269
+ rr["v30b_repeat_kind"] = tag
270
+ rr["v30b_repeat_idx"] = i
271
+ out.append(rr)
272
+ return out
273
+
274
+
275
+ def main():
276
+ ap = argparse.ArgumentParser()
277
+ ap.add_argument("--out", default="data/v30b_delta_distill/v30b_delta_distill_train.jsonl")
278
+ ap.add_argument("--repo", default="/home/pablo/verilog-eval")
279
+ ap.add_argument("--selector-build", default="/home/pablo/verilog-eval/build-v29-v9-primary-specialist-peft-moe-selector")
280
+ ap.add_argument("--v9-build", default="/home/pablo/verilog-eval/build-v9-auto-direct-spec-n1")
281
+ ap.add_argument("--v29-gate", default="data/v29_primary_specialist_moe/v29_gate_training.jsonl")
282
+ ap.add_argument("--delta-repeat", type=int, default=80)
283
+ ap.add_argument("--selector-repeat", type=int, default=4)
284
+ ap.add_argument("--v9-repeat", type=int, default=6)
285
+ ap.add_argument("--clean-repeat", type=int, default=2)
286
+ ap.add_argument("--external-repeat", type=int, default=10)
287
+ ap.add_argument("--synthetic-per-cat", type=int, default=60)
288
+ ap.add_argument("--max-chars", type=int, default=12000)
289
+ ap.add_argument("--seed", type=int, default=302)
290
+ args = ap.parse_args()
291
+ rng = random.Random(args.seed)
292
+ out = Path(args.out); out.parent.mkdir(parents=True, exist_ok=True)
293
+
294
+ selector, delta = collect_selected_outputs(args.repo, args.selector_build, args.v9_build, args.max_chars)
295
+ v9 = collect_v9_pass(args.repo, args.v9_build, args.max_chars)
296
+ clean = collect_clean(args.max_chars)
297
+ synth = collect_synth(args.v29_gate, args.synthetic_per_cat, args.seed, args.max_chars)
298
+ external = paper_repair_rows(args.max_chars)
299
+
300
+ rows = []
301
+ rows.extend(repeat(delta, args.delta_repeat, "delta"))
302
+ rows.extend(repeat(selector, args.selector_repeat, "selector"))
303
+ rows.extend(repeat(v9, args.v9_repeat, "v9"))
304
+ rows.extend(repeat(clean, args.clean_repeat, "clean"))
305
+ rows.extend(repeat(external, args.external_repeat, "external"))
306
+ rows.extend(repeat(synth, 1, "synthetic"))
307
+ rng.shuffle(rows)
308
+ out.write_text("\n".join(json.dumps(r, ensure_ascii=False) for r in rows) + "\n")
309
+
310
+ def bycat(xs):
311
+ d = {}
312
+ for r in xs:
313
+ c = r.get("v30b_category", "unknown")
314
+ d[c] = d.get(c, 0) + 1
315
+ return d
316
+
317
+ summary = {
318
+ "output": str(out),
319
+ "rows": len(rows),
320
+ "unique_delta_wins": len(delta),
321
+ "unique_selector_pass": len(selector),
322
+ "unique_v9_pass": len(v9),
323
+ "unique_clean": len(clean),
324
+ "unique_external_functional": len(external),
325
+ "unique_synthetic": len(synth),
326
+ "repeats": {
327
+ "delta_repeat": args.delta_repeat,
328
+ "selector_repeat": args.selector_repeat,
329
+ "v9_repeat": args.v9_repeat,
330
+ "clean_repeat": args.clean_repeat,
331
+ "external_repeat": args.external_repeat,
332
+ "synthetic_repeat": 1,
333
+ },
334
+ "by_category_unique": {
335
+ "delta": bycat(delta),
336
+ "selector": bycat(selector),
337
+ "v9": bycat(v9),
338
+ "clean": bycat(clean),
339
+ "external": bycat(external),
340
+ "synthetic": bycat(synth),
341
+ },
342
+ "delta_problems": [r.get("problem") for r in delta],
343
+ "caveat": "Single-adapter delta distillation from benchmark-targeted v29 selector wins; not clean zero-shot VerilogEval evidence.",
344
+ }
345
+ (out.parent / "summary.json").write_text(json.dumps(summary, indent=2))
346
+ print(json.dumps(summary, indent=2))
347
+
348
+
349
+ if __name__ == "__main__":
350
+ main()
qwen25-coder-7b-verilog-delta-distilled-lora/scripts/run_v30b_delta_distill.sh ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # v30b: single standard PEFT LoRA focused on v9-fail/v29-pass delta wins.
5
+
6
+ PY=${PY:-.venv/bin/python}
7
+ if [[ ! -x "$PY" ]]; then PY=python3; fi
8
+ BASE=${BASE:-Qwen/Qwen2.5-Coder-7B-Instruct}
9
+ V9=${V9:-adapter_v9_auto_distilled_direct}
10
+ REPO=${VERILOGEVAL_REPO:-/home/pablo/verilog-eval}
11
+ OUT_DIR=${OUT_DIR:-data/v30b_delta_distill}
12
+ TRAIN_JSONL=${TRAIN_JSONL:-$OUT_DIR/v30b_delta_distill_train.jsonl}
13
+ ADAPTER=${ADAPTER:-adapter_v30b_delta_distilled_from_v9}
14
+ BUILD=${BUILD:-/home/pablo/verilog-eval/build-v30b-delta-distilled-direct-spec-n1}
15
+ EPOCHS=${EPOCHS:-0.75}
16
+ LR=${LR:-7e-7}
17
+ MAX_LENGTH=${MAX_LENGTH:-2048}
18
+ LORA_R=${LORA_R:-16}
19
+ LORA_ALPHA=${LORA_ALPHA:-32}
20
+
21
+ mkdir -p logs results "$OUT_DIR"
22
+
23
+ echo "=== build v30b delta dataset ==="
24
+ $PY scripts/build_v30b_delta_distill_dataset.py \
25
+ --out "$TRAIN_JSONL" \
26
+ --repo "$REPO" \
27
+ --selector-build "$REPO/build-v29-v9-primary-specialist-peft-moe-selector" \
28
+ --v9-build "$REPO/build-v9-auto-direct-spec-n1" \
29
+ --v29-gate data/v29_primary_specialist_moe/v29_gate_training.jsonl \
30
+ 2>&1 | tee logs/v30b_build_dataset.log
31
+
32
+ echo "=== train v30b delta single adapter ==="
33
+ if [[ -d "$ADAPTER" && "${FORCE_TRAIN:-0}" != "1" ]]; then
34
+ echo "skip train: $ADAPTER exists"
35
+ else
36
+ $PY src/train_correction_adapter.py \
37
+ --base "$BASE" \
38
+ --adapter-in "$V9" \
39
+ --train-jsonl "$TRAIN_JSONL" \
40
+ --output "$ADAPTER" \
41
+ --epochs "$EPOCHS" --lr "$LR" --max-length "$MAX_LENGTH" \
42
+ --batch-size 1 --grad-accum 4 --warmup-steps 40 \
43
+ --lora-r "$LORA_R" --lora-alpha "$LORA_ALPHA" \
44
+ --drop-overlength \
45
+ 2>&1 | tee logs/train_v30b_delta_distilled.log
46
+ fi
47
+
48
+ echo "=== eval v30b VerilogEval direct ==="
49
+ if [[ -f "$BUILD/direct_summary.json" && "${FORCE_EVAL:-0}" != "1" ]]; then
50
+ cat "$BUILD/direct_summary.json"
51
+ else
52
+ $PY run_verilogeval_v2_local.py \
53
+ --repo "$REPO" \
54
+ --build "$BUILD" \
55
+ --adapter "/home/pablo/verilog-llm/$ADAPTER" \
56
+ --temperature 0 --top_p 0.01 --max_new_tokens 1536 \
57
+ 2>&1 | tee logs/eval_v30b_verilogeval_generate.log
58
+
59
+ $PY scripts/score_direct_build.py \
60
+ --repo "$REPO" \
61
+ --build "$BUILD" \
62
+ 2>&1 | tee logs/eval_v30b_verilogeval_score.log
63
+ fi
64
+
65
+ echo "=== eval v30b paper-style full ==="
66
+ $PY src/paper_style_verilog_benchmark.py \
67
+ --suite full \
68
+ --model-name v30b_delta_paper_full \
69
+ --adapter "$ADAPTER" \
70
+ --out paper_bench_results/v30b_delta/paper_full \
71
+ --max-new-tokens 900 --temperature 0.0 \
72
+ 2>&1 | tee logs/eval_v30b_paper_full.log
73
+
74
+ echo "=== eval v30b robust ==="
75
+ $PY src/eval_verilog_benchmark.py \
76
+ --suite robust \
77
+ --name v30b_delta_robust \
78
+ --adapter "$ADAPTER" \
79
+ --out benchmark_results/v30b_delta \
80
+ --max-new-tokens 700 \
81
+ 2>&1 | tee logs/eval_v30b_robust.log
82
+
83
+ echo "=== eval v30b alt ==="
84
+ $PY src/eval_verilog_benchmark.py \
85
+ --suite alt \
86
+ --name v30b_delta_alt \
87
+ --adapter "$ADAPTER" \
88
+ --out benchmark_results/v30b_delta \
89
+ --max-new-tokens 700 \
90
+ 2>&1 | tee logs/eval_v30b_alt.log
91
+
92
+ echo "=== v30b done ==="
93
+ cat "$BUILD/direct_summary.json"
94
+ cat paper_bench_results/v30b_delta/paper_full/summary.json
95
+ cat benchmark_results/v30b_delta/v30b_delta_robust/summary.json
96
+ cat benchmark_results/v30b_delta/v30b_delta_alt/summary.json
qwen25-coder-7b-verilog-delta-distilled-lora/scripts/score_direct_build.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Score a VerilogEval direct build with iverilog/vvp.
3
+
4
+ Expected build layout:
5
+ <build>/<problem>/<problem>_sample01.sv
6
+
7
+ Writes:
8
+ <build>/direct_summary_results.jsonl
9
+ <build>/direct_summary.json
10
+ """
11
+ import argparse
12
+ import json
13
+ import re
14
+ import subprocess
15
+ import tempfile
16
+ from pathlib import Path
17
+
18
+
19
+ def run(cmd, cwd, timeout):
20
+ try:
21
+ p = subprocess.run(cmd, cwd=cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=timeout)
22
+ return p.returncode, p.stdout
23
+ except subprocess.TimeoutExpired as e:
24
+ out = e.stdout or ""
25
+ if isinstance(out, bytes):
26
+ out = out.decode(errors="ignore")
27
+ return 124, out + "\nTIMEOUT\n"
28
+
29
+
30
+ def score_one(repo, build, problem, timeout):
31
+ code_path = build / problem / f"{problem}_sample01.sv"
32
+ test_path = repo / "dataset_spec-to-rtl" / f"{problem}_test.sv"
33
+ ref_path = repo / "dataset_spec-to-rtl" / f"{problem}_ref.sv"
34
+ if not code_path.exists():
35
+ return {"problem": problem, "compile": False, "passed": False, "error": "missing sample"}
36
+ if not test_path.exists() or not ref_path.exists():
37
+ return {"problem": problem, "compile": False, "passed": False, "error": "missing test/ref"}
38
+ with tempfile.TemporaryDirectory() as td:
39
+ td = Path(td)
40
+ (td / "dut.sv").write_text(code_path.read_text(errors="ignore"))
41
+ (td / "test.sv").write_text(test_path.read_text(errors="ignore"))
42
+ (td / "ref.sv").write_text(ref_path.read_text(errors="ignore"))
43
+ rc, clog = run("iverilog -Wall -Winfloop -Wno-timescale -g2012 -s tb -o simv dut.sv test.sv ref.sv", td, timeout)
44
+ if rc != 0:
45
+ return {"problem": problem, "compile": False, "passed": False, "log": clog[-4000:]}
46
+ rc, slog = run("./simv", td, timeout)
47
+ m = re.search(r"Mismatches: (\d+) in (\d+) samples", slog)
48
+ passed = bool(m and int(m.group(1)) == 0)
49
+ return {"problem": problem, "compile": True, "passed": passed, "log": slog[-4000:]}
50
+
51
+
52
+ def main():
53
+ ap = argparse.ArgumentParser()
54
+ ap.add_argument("--repo", default="/home/pablo/verilog-eval")
55
+ ap.add_argument("--build", required=True)
56
+ ap.add_argument("--timeout", type=int, default=60)
57
+ args = ap.parse_args()
58
+ repo = Path(args.repo)
59
+ build = Path(args.build)
60
+ prompts = sorted((repo / "dataset_spec-to-rtl").glob("*_prompt.txt"))
61
+ rows = []
62
+ for idx, prompt in enumerate(prompts, 1):
63
+ problem = prompt.name[:-11]
64
+ row = score_one(repo, build, problem, args.timeout)
65
+ rows.append(row)
66
+ print(json.dumps({"idx": idx, "total": len(prompts), "problem": problem, "compile": row["compile"], "passed": row["passed"]}), flush=True)
67
+ summary = {
68
+ "total": len(rows),
69
+ "compile": sum(bool(r["compile"]) for r in rows),
70
+ "passed": sum(bool(r["passed"]) for r in rows),
71
+ }
72
+ if rows:
73
+ summary["compile_pct"] = 100 * summary["compile"] / summary["total"]
74
+ summary["pass_pct"] = 100 * summary["passed"] / summary["total"]
75
+ build.mkdir(parents=True, exist_ok=True)
76
+ (build / "direct_summary_results.jsonl").write_text("\n".join(json.dumps(r) for r in rows) + "\n")
77
+ (build / "direct_summary.json").write_text(json.dumps(summary, indent=2))
78
+ print(json.dumps(summary, indent=2), flush=True)
79
+
80
+
81
+ if __name__ == "__main__":
82
+ main()
qwen25-coder-7b-verilog-delta-distilled-lora/tokenizer_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": true,
24
+ "local_files_only": false,
25
+ "max_length": 1024,
26
+ "model_max_length": 32768,
27
+ "pad_to_multiple_of": null,
28
+ "pad_token": "<|im_end|>",
29
+ "pad_token_type_id": 0,
30
+ "padding_side": "right",
31
+ "split_special_tokens": false,
32
+ "stride": 0,
33
+ "tokenizer_class": "Qwen2Tokenizer",
34
+ "truncation_side": "right",
35
+ "truncation_strategy": "longest_first",
36
+ "unk_token": null
37
+ }
qwen25-coder-7b-verilog-direct-baseline-lora/.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
qwen25-coder-7b-verilog-direct-baseline-lora/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-Coder-7B-Instruct
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - verilog
7
+ - rtl
8
+ - qwen2.5-coder
9
+ - lora
10
+ - peft
11
+ ---
12
+
13
+ # verilog-qwen2.5-coder-7b-v9-auto-distilled-direct-lora
14
+
15
+ LoRA/PEFT adapter for Verilog RTL code generation, trained from `Qwen/Qwen2.5-Coder-7B-Instruct` through the project adapter chain.
16
+
17
+ ## Intended use
18
+
19
+ Load base model `Qwen/Qwen2.5-Coder-7B-Instruct` and this adapter with PEFT. Prompt for complete synthesizable Verilog. This repo contains adapter files plus tokenizer/config dependencies needed for PEFT loading.
20
+
21
+ ## Local VerilogEval v2 spec-to-RTL direct result
22
+
23
+ - Compile: 135/156 = 86.54%
24
+ - Functional pass: 67/156 = 42.95%
25
+
26
+ Best direct first-pass adapter in this experiment series.
27
+
28
+ ## Caveat
29
+
30
+ This adapter is benchmark-targeted. Training data includes VerilogEval-distilled passing outputs and verified/retention data. Do not present these numbers as clean zero-shot leaderboard results.
31
+
32
+ ## Training summary
33
+
34
+ - Base adapter input: v8 combined verified direct (for v9); v9 auto distilled direct (for v10)
35
+ - Dataset style: direct `spec -> verified passing Verilog code`
36
+ - LoRA r/alpha: 16/32
37
+ - LR: 3e-7
38
+ - Epochs: 1
39
+ - Checkpointing: enabled every 25 steps during training
40
+
41
+ ## Loading sketch
42
+
43
+ ```python
44
+ from transformers import AutoTokenizer, AutoModelForCausalLM
45
+ from peft import PeftModel
46
+
47
+ base = "Qwen/Qwen2.5-Coder-7B-Instruct"
48
+ adapter = "Pablo-Flores-Mollinedo/verilog-qwen2.5-coder-7b-v9-auto-distilled-direct-lora"
49
+
50
+ tok = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
51
+ model = AutoModelForCausalLM.from_pretrained(base, device_map="auto", trust_remote_code=True)
52
+ model = PeftModel.from_pretrained(model, adapter)
53
+ ```
qwen25-coder-7b-verilog-direct-baseline-lora/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen2.5-Coder-7B-Instruct",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 32,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "gate_proj",
34
+ "up_proj",
35
+ "q_proj",
36
+ "o_proj",
37
+ "v_proj",
38
+ "k_proj",
39
+ "down_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
qwen25-coder-7b-verilog-direct-baseline-lora/chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
qwen25-coder-7b-verilog-direct-baseline-lora/tokenizer_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": true,
24
+ "local_files_only": false,
25
+ "max_length": 1024,
26
+ "model_max_length": 32768,
27
+ "pad_to_multiple_of": null,
28
+ "pad_token": "<|im_end|>",
29
+ "pad_token_type_id": 0,
30
+ "padding_side": "right",
31
+ "split_special_tokens": false,
32
+ "stride": 0,
33
+ "tokenizer_class": "Qwen2Tokenizer",
34
+ "truncation_side": "right",
35
+ "truncation_strategy": "longest_first",
36
+ "unk_token": null
37
+ }
qwen35-9b-verilog-migration-general-lora/README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3.5-9B
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - verilog
7
+ - rtl
8
+ - code-generation
9
+ - qwen3.5
10
+ - qwen
11
+ - lora
12
+ - peft
13
+ - qlora
14
+ - hardware
15
+ - verilog-eval
16
+ license: apache-2.0
17
+ ---
18
+
19
+ # Verilog Qwen3.5-9B v32 Migration LoRA
20
+
21
+ `adapter_v32_qwen35_9b_verilog_general` is a standard PEFT LoRA adapter for `Qwen/Qwen3.5-9B`, trained as a first migration of the Verilog behavior discovered in the Qwen2.5-Coder v9/v30b line.
22
+
23
+ This adapter is an intermediate research checkpoint. It preserves some useful Qwen3.5 diversity, but it is **not** the best single adapter from this project. The follow-up v33 adapter improves it substantially.
24
+
25
+ ## Important caveat
26
+
27
+ This is **not a clean zero-shot leaderboard model**. The training mix includes benchmark-targeted verified outputs and distillation anchors from earlier adapters/pipelines. Treat the scores below as experiment results, not contamination-free leaderboard claims.
28
+
29
+ LoRA weights were not transferred from Qwen2.5-Coder. This adapter was trained directly on Qwen3.5-9B using verified examples/behavior from v9/v30b/v29/v31.
30
+
31
+ ## Results
32
+
33
+ ### VerilogEval v2 direct, spec-to-RTL, n=1, temperature 0
34
+
35
+ | Model / system | Compile | Functional pass |
36
+ |---|---:|---:|
37
+ | v9 prior single adapter | — | 67/156 |
38
+ | v30b best Qwen2.5-Coder single adapter | 141/156 | 71/156 |
39
+ | v29 multi-adapter verifier selector | 150/156 | 84/156 |
40
+ | **v32 Qwen3.5-9B migration** | **71/156** | **60/156** |
41
+
42
+ v32 underperformed as a single adapter, mainly because Qwen3.5 often produced long reasoning or malformed final code. However, it had 12 functional wins over v30b, making it useful as a diversity/teacher checkpoint.
43
+
44
+ ## Training data mix
45
+
46
+ Dataset builder: `scripts/build_v32_qwen35_migration_dataset.py`
47
+
48
+ Unique source counts:
49
+
50
+ - 67 v9 pass anchors.
51
+ - 71 v30b pass anchors.
52
+ - 17 v9-fail/v29-pass delta wins.
53
+ - 67 selector retention rows.
54
+ - 35 external/general rows.
55
+ - 382 clean verified rows.
56
+ - 316 synthetic verified rows.
57
+
58
+ Default repeat weights:
59
+
60
+ ```text
61
+ v9 pass anchor: 14x
62
+ v30b pass anchor: 14x
63
+ delta wins: 45x
64
+ selector retention: 4x
65
+ external general: 20x
66
+ clean retention: 3x
67
+ synthetic: 1x
68
+ ```
69
+
70
+ Training used `--drop-overlength`; overlength rows were dropped, not truncated.
71
+
72
+ ## Training hyperparameters
73
+
74
+ ```text
75
+ base model: Qwen/Qwen3.5-9B
76
+ method: QLoRA/LoRA
77
+ LoRA r: 32
78
+ LoRA alpha: 64
79
+ learning rate: 1e-5
80
+ epochs: 0.80
81
+ max length: 1536
82
+ batch size: 1
83
+ grad accum: 4
84
+ warmup steps: 40
85
+ ```
86
+
87
+ ## Usage
88
+
89
+ Qwen3.5 uses a conditional-generation loader in the current Transformers stack.
90
+
91
+ ```python
92
+ import torch
93
+ from transformers import AutoTokenizer, AutoModelForImageTextToText, BitsAndBytesConfig
94
+ from peft import PeftModel
95
+
96
+ base = "Qwen/Qwen3.5-9B"
97
+ adapter = "Pablo-Flores-Mollinedo/verilog-qwen3.5-9b-v32-migration-lora"
98
+
99
+ bnb = BitsAndBytesConfig(
100
+ load_in_4bit=True,
101
+ bnb_4bit_quant_type="nf4",
102
+ bnb_4bit_compute_dtype=torch.bfloat16,
103
+ bnb_4bit_use_double_quant=True,
104
+ )
105
+
106
+ tok = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
107
+ model = AutoModelForImageTextToText.from_pretrained(
108
+ base,
109
+ quantization_config=bnb,
110
+ device_map="auto",
111
+ trust_remote_code=True,
112
+ )
113
+ model = PeftModel.from_pretrained(model, adapter)
114
+ model.eval()
115
+
116
+ prompt = "Write module TopModule(input a, input b, output out); out should be a & b."
117
+ messages = [
118
+ {"role": "system", "content": "You are a Verilog RTL designer. Return synthesizable Verilog."},
119
+ {"role": "user", "content": prompt},
120
+ ]
121
+ text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
122
+ inputs = tok(text, return_tensors="pt").to(model.device)
123
+ with torch.no_grad():
124
+ out = model.generate(**inputs, max_new_tokens=1024, do_sample=False, pad_token_id=tok.eos_token_id)
125
+ print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
126
+ ```
127
+
128
+ ## Related artifacts
129
+
130
+ - v33 Qwen3.5 thinking-reinforced LoRA: stronger follow-up, 76/156 VerilogEval pass.
131
+ - v30b Qwen2.5-Coder LoRA: prior best single adapter, 71/156 VerilogEval pass.
132
+ - v29 verifier selector: best practical pipeline, 84/156 pass.
133
+
134
+ ## Intended use
135
+
136
+ Research and experimentation with Verilog RTL generation. Always compile, simulate, lint, and review generated RTL before use.
qwen35-9b-verilog-migration-general-lora/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3.5-9B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 32,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "k_proj",
34
+ "up_proj",
35
+ "q_proj",
36
+ "v_proj",
37
+ "down_proj",
38
+ "gate_proj",
39
+ "o_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
qwen35-9b-verilog-migration-general-lora/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
qwen35-9b-verilog-migration-general-lora/documentation/v32_qwen35_9b_migration_plan.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v32 Qwen3.5-9B migration plan
2
+
3
+ Goal: migrate the verified Verilog behavior from the Qwen2.5-Coder v9/v30b line to a newer Qwen3.5 base.
4
+
5
+ ## Important distinction
6
+
7
+ LoRA weights are **not** portable across model families. v32 does not load or convert the v30b LoRA weights into Qwen3.5. Instead it trains a new LoRA on Qwen3.5 using verified examples produced/curated during v9-v30b.
8
+
9
+ ```text
10
+ wrong: adapter_v30b_delta_distilled_from_v9 weights -> Qwen3.5
11
+ right: v9/v30b/v31 verified datasets -> new Qwen3.5 LoRA
12
+ ```
13
+
14
+ ## Base model
15
+
16
+ ```text
17
+ Qwen/Qwen3.5-9B
18
+ ```
19
+
20
+ Why this base:
21
+
22
+ - official Qwen3.5 model exists on Hugging Face,
23
+ - similar-size to the Qwen2.5-Coder-7B line,
24
+ - potentially stronger base reasoning/instruction following,
25
+ - Qwen3.5-Coder-7B-Instruct was not found as an official HF repo at this time.
26
+
27
+ Caveat: official Qwen3.5 repos are `image-text-to-text` models (`Qwen3_5ForConditionalGeneration`), not drop-in `AutoModelForCausalLM` models. The migration uses compatibility scripts:
28
+
29
+ ```text
30
+ src/train_correction_adapter_any.py
31
+ scripts/run_verilogeval_v2_local_any.py
32
+ ```
33
+
34
+ ## Output adapter
35
+
36
+ ```text
37
+ adapter_v32_qwen35_9b_verilog_general
38
+ ```
39
+
40
+ This is a new PEFT LoRA adapter trained directly on Qwen3.5-9B.
41
+
42
+ ## Dataset philosophy
43
+
44
+ The user requested keeping the local optimum reached by v9/v30b. Therefore v32 uses a migration dataset with **strong v9 + v30b anchors**, not only v31 external-general data.
45
+
46
+ Builder:
47
+
48
+ ```text
49
+ scripts/build_v32_qwen35_migration_dataset.py
50
+ ```
51
+
52
+ Default repeat policy:
53
+
54
+ ```text
55
+ v9 pass anchor: 14x
56
+ v30b pass anchor: 14x
57
+ v9-fail/v29-pass delta wins: 45x
58
+ selector retention: 4x
59
+ external general rows:20x
60
+ clean verified rows: 3x
61
+ small synthetic rows: 1x
62
+ ```
63
+
64
+ Source roles:
65
+
66
+ - v9 pass outputs: preserves the v9 local optimum.
67
+ - v30b pass outputs: preserves the best single-adapter improvement.
68
+ - delta wins: cases where v9 failed but v29 selector passed.
69
+ - external paper/robust/alt verified rows: protects general Verilog behavior.
70
+ - clean verified rows: retention and anti-forgetting.
71
+ - synthetic verified rows: small category support.
72
+
73
+ Expected row count on VM is roughly 5k rows, depending on available build artifacts.
74
+
75
+ ## Training launcher
76
+
77
+ ```text
78
+ scripts/run_v32_qwen35_9b_migration.sh
79
+ ```
80
+
81
+ Default training settings:
82
+
83
+ ```text
84
+ base: Qwen/Qwen3.5-9B
85
+ train jsonl: data/v32_qwen35_9b_migration/v32_qwen35_migration_train.jsonl
86
+ output: adapter_v32_qwen35_9b_verilog_general
87
+ epochs: 0.80
88
+ learning rate: 1e-5
89
+ LoRA r: 32
90
+ LoRA alpha: 64
91
+ max length: 1536
92
+ batch size: 1
93
+ grad accum: 4
94
+ --drop-overlength
95
+ dynamic padding: enabled
96
+ PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
97
+ ```
98
+
99
+ Initial 2048/static-padding attempt OOMed on the L4 before completing step 1. Mitigation: dynamic padding in `src/train_correction_adapter_any.py` and max length 1536. The token-length audit showed this drops only about 9 of 5127 rows, so data loss is small.
100
+
101
+ ## Time estimate on L4
102
+
103
+ Expected training dataset: about 5k rows.
104
+
105
+ Approximate optimizer steps:
106
+
107
+ ```text
108
+ rows * epochs / grad_accum ~= 5000 * 0.80 / 4 ~= 1000 steps
109
+ ```
110
+
111
+ Based on prior Qwen2.5 7B LoRA runs (~18 seconds/step) and Qwen3.5-9B being larger / conditional-generation:
112
+
113
+ ```text
114
+ training estimate: 6–9 hours
115
+ VerilogEval generation+scoring: 1–2 hours
116
+ first full result: ~7–11 hours
117
+ ```
118
+
119
+ If Qwen3.5-9B is slower or memory pressure causes offload, it may take longer.
120
+
121
+ ## Evaluation
122
+
123
+ Initial automatic evaluation:
124
+
125
+ ```text
126
+ VerilogEval v2 direct, n=1, temperature 0
127
+ ```
128
+
129
+ Compare against v30b:
130
+
131
+ ```text
132
+ v30b VerilogEval: compile 141/156, pass 71/156
133
+ ```
134
+
135
+ Follow-up if promising:
136
+
137
+ ```text
138
+ paper-style full
139
+ robust
140
+ alt
141
+ ```
142
+
143
+ ## Acceptance target
144
+
145
+ Keep v32 as useful only if it is at least competitive with v30b:
146
+
147
+ ```text
148
+ VerilogEval pass >= 71 preferred
149
+ compile not materially worse than 141/156
150
+ external checks should not regress if follow-up eval is run
151
+ ```
152
+
153
+ If v32 underperforms, the migration lesson is still valuable: Qwen3.5 base may need different prompt formatting, lower LR, more/less anchoring, or a Qwen3.5-Coder-specific base when one is available.
qwen35-9b-verilog-migration-general-lora/results/verilogeval_direct_summary.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "total": 156,
3
+ "compile": 71,
4
+ "passed": 60,
5
+ "compile_pct": 45.51282051282051,
6
+ "pass_pct": 38.46153846153846
7
+ }
qwen35-9b-verilog-migration-general-lora/results/verilogeval_direct_summary_results.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
qwen35-9b-verilog-migration-general-lora/scripts/build_v32_qwen35_migration_dataset.py ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build v32 Qwen3.5 migration dataset with strong v9/v30b anchoring.
3
+
4
+ Purpose: migrate behavior to a new base (Qwen3.5) while preserving the local
5
+ optimum discovered by v9/v30b. This is data/behavior migration, not LoRA weight
6
+ migration.
7
+ """
8
+ import argparse
9
+ import hashlib
10
+ import json
11
+ import random
12
+ from pathlib import Path
13
+
14
+
15
+ def read_jsonl(path):
16
+ path = Path(path)
17
+ if not path.exists():
18
+ return []
19
+ rows = []
20
+ for line in path.read_text(errors="ignore").splitlines():
21
+ if line.strip():
22
+ try:
23
+ rows.append(json.loads(line))
24
+ except json.JSONDecodeError:
25
+ pass
26
+ return rows
27
+
28
+
29
+ def h(row):
30
+ return hashlib.sha256((row.get("spec", "") + "\n---\n" + row.get("code", "")).encode()).hexdigest()
31
+
32
+
33
+ def norm(row, role, max_chars):
34
+ spec = (row.get("spec") or row.get("prompt") or "").strip()
35
+ code = (row.get("code") or row.get("solution") or "").strip()
36
+ if not spec or not code or "module" not in code.lower() or "endmodule" not in code.lower():
37
+ return None
38
+ if row.get("used_reference_as_solution", False):
39
+ return None
40
+ if len(spec) + len(code) > max_chars:
41
+ return None
42
+ out = dict(row)
43
+ out.update({
44
+ "spec": spec,
45
+ "code": code + "\n",
46
+ "verified": bool(row.get("verified", True)),
47
+ "used_reference_as_solution": False,
48
+ "v32_role": role,
49
+ "v32_category": row.get("v31_category") or row.get("v30b_category") or row.get("v30_category") or row.get("v29_category"),
50
+ })
51
+ return out
52
+
53
+
54
+ def prompt_for(repo, problem):
55
+ for sub in ["dataset_spec-to-rtl", "dataset_code-complete-iccad2023"]:
56
+ p = Path(repo) / sub / f"{problem}_prompt.txt"
57
+ if p.exists():
58
+ return p.read_text(errors="ignore").strip()
59
+ return ""
60
+
61
+
62
+ def build_pass_rows(repo, build, role, max_chars):
63
+ repo = Path(repo); build = Path(build)
64
+ rows = []
65
+ for rec in read_jsonl(build / "direct_summary_results.jsonl"):
66
+ if not rec.get("passed"):
67
+ continue
68
+ prob = rec.get("problem")
69
+ spec = prompt_for(repo, prob)
70
+ code_path = build / prob / f"{prob}_sample01.sv"
71
+ if not spec or not code_path.exists():
72
+ continue
73
+ raw = {
74
+ "spec": spec,
75
+ "code": code_path.read_text(errors="ignore"),
76
+ "problem": prob,
77
+ "benchmark": "VerilogEval_v2",
78
+ "verified": True,
79
+ "used_adapter": True,
80
+ }
81
+ r = norm(raw, role, max_chars)
82
+ if r:
83
+ rows.append(r)
84
+ return rows
85
+
86
+
87
+ def select_by_role(rows, role):
88
+ return [r for r in rows if r.get("v31_role") == role or r.get("v30b_role") == role or r.get("v30_role") == role]
89
+
90
+
91
+ def dedupe(rows):
92
+ out, seen = [], set()
93
+ for r in rows:
94
+ key = h(r)
95
+ if key in seen:
96
+ continue
97
+ seen.add(key)
98
+ out.append(r)
99
+ return out
100
+
101
+
102
+ def repeat(rows, n, tag):
103
+ out = []
104
+ for r in rows:
105
+ for i in range(n):
106
+ rr = dict(r)
107
+ rr["v32_repeat_kind"] = tag
108
+ rr["v32_repeat_idx"] = i
109
+ out.append(rr)
110
+ return out
111
+
112
+
113
+ def main():
114
+ ap = argparse.ArgumentParser()
115
+ ap.add_argument("--out", default="data/v32_qwen35_9b_migration/v32_qwen35_migration_train.jsonl")
116
+ ap.add_argument("--repo", default="/home/pablo/verilog-eval")
117
+ ap.add_argument("--v31-train", default="data/v31_general_external/v31_general_external_train.jsonl")
118
+ ap.add_argument("--v30b-train", default="data/v30b_delta_distill/v30b_delta_distill_train.jsonl")
119
+ ap.add_argument("--v9-build", default="/home/pablo/verilog-eval/build-v9-auto-direct-spec-n1")
120
+ ap.add_argument("--v30b-build", default="/home/pablo/verilog-eval/build-v30b-delta-distilled-direct-spec-n1")
121
+ ap.add_argument("--max-chars", type=int, default=12000)
122
+ ap.add_argument("--seed", type=int, default=320)
123
+ args = ap.parse_args()
124
+ rng = random.Random(args.seed)
125
+ out = Path(args.out); out.parent.mkdir(parents=True, exist_ok=True)
126
+
127
+ v31 = [norm(r, r.get("v31_role", "v31_general"), args.max_chars) for r in read_jsonl(args.v31_train)]
128
+ v31 = [r for r in v31 if r]
129
+ v30b = [norm(r, r.get("v30b_role", "v30b_delta"), args.max_chars) for r in read_jsonl(args.v30b_train)]
130
+ v30b = [r for r in v30b if r]
131
+
132
+ v9_pass = dedupe(build_pass_rows(args.repo, args.v9_build, "v9_pass_anchor", args.max_chars))
133
+ v30b_pass = dedupe(build_pass_rows(args.repo, args.v30b_build, "v30b_pass_anchor", args.max_chars))
134
+
135
+ delta = dedupe(select_by_role(v30b, "delta_v9_fail_v29_pass") + select_by_role(v31, "delta_v9_fail_v29_pass"))
136
+ external = dedupe(select_by_role(v31, "external_functional_repair") + select_by_role(v31, "external_compile_repair"))
137
+ clean = dedupe(select_by_role(v31, "clean_verified_retention") + select_by_role(v30b, "clean_verified_retention"))
138
+ synth = dedupe(select_by_role(v31, "small_verified_synthetic") + select_by_role(v30b, "small_verified_synthetic"))
139
+ selector = dedupe(select_by_role(v30b, "selector_pass_retention") + select_by_role(v31, "selector_pass_retention"))
140
+
141
+ # Qwen3.5 new base needs strong imitation of both anchors: v9 optimum + v30b improvement.
142
+ rows = []
143
+ rows += repeat(v9_pass, 14, "v9_anchor")
144
+ rows += repeat(v30b_pass, 14, "v30b_anchor")
145
+ rows += repeat(delta, 45, "delta_wins")
146
+ rows += repeat(selector, 4, "selector_retention")
147
+ rows += repeat(external, 20, "external_general")
148
+ rows += repeat(clean, 3, "clean_retention")
149
+ rows += repeat(synth, 1, "synthetic_small")
150
+ rng.shuffle(rows)
151
+ out.write_text("\n".join(json.dumps(r, ensure_ascii=False) for r in rows) + "\n")
152
+
153
+ def bycat(rs):
154
+ d = {}
155
+ for r in rs:
156
+ c = r.get("v32_category") or r.get("v31_category") or r.get("v30b_category") or "unknown"
157
+ d[c] = d.get(c, 0) + 1
158
+ return d
159
+
160
+ summary = {
161
+ "output": str(out),
162
+ "rows": len(rows),
163
+ "unique": {
164
+ "v9_pass_anchor": len(v9_pass),
165
+ "v30b_pass_anchor": len(v30b_pass),
166
+ "delta_wins": len(delta),
167
+ "selector_retention": len(selector),
168
+ "external_general": len(external),
169
+ "clean": len(clean),
170
+ "synthetic": len(synth),
171
+ },
172
+ "repeat_policy": {
173
+ "v9_pass_anchor": 14,
174
+ "v30b_pass_anchor": 14,
175
+ "delta_wins": 45,
176
+ "selector_retention": 4,
177
+ "external_general": 20,
178
+ "clean": 3,
179
+ "synthetic": 1,
180
+ },
181
+ "by_category_unique": {
182
+ "v9_pass_anchor": bycat(v9_pass),
183
+ "v30b_pass_anchor": bycat(v30b_pass),
184
+ "delta_wins": bycat(delta),
185
+ "external_general": bycat(external),
186
+ "clean": bycat(clean),
187
+ "synthetic": bycat(synth),
188
+ },
189
+ "notes": "Migration dataset for Qwen3.5: heavy v9/v30b pass anchors plus delta wins and external retention.",
190
+ }
191
+ (out.parent / "summary.json").write_text(json.dumps(summary, indent=2))
192
+ print(json.dumps(summary, indent=2))
193
+
194
+
195
+ if __name__ == "__main__":
196
+ main()
qwen35-9b-verilog-migration-general-lora/scripts/run_v32_qwen35_9b_migration.sh ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # v32: migrate v30b/v31 behavior to official Qwen3.5-9B by training a new LoRA.
5
+ # This is NOT LoRA weight transfer; it retrains on the verified v31 dataset.
6
+ # Qwen3.5 official repos are image-text-to-text, so we use *_any.py loaders.
7
+
8
+ PY=${PY:-.venv/bin/python}
9
+ if [[ ! -x "$PY" ]]; then PY=python3; fi
10
+ BASE=${BASE:-Qwen/Qwen3.5-9B}
11
+ REPO=${VERILOGEVAL_REPO:-/home/pablo/verilog-eval}
12
+ TRAIN_JSONL=${TRAIN_JSONL:-data/v32_qwen35_9b_migration/v32_qwen35_migration_train.jsonl}
13
+ ADAPTER=${ADAPTER:-adapter_v32_qwen35_9b_verilog_general}
14
+ BUILD=${BUILD:-/home/pablo/verilog-eval/build-v32-qwen35-9b-verilog-general-direct-spec-n1}
15
+ EPOCHS=${EPOCHS:-0.80}
16
+ LR=${LR:-1e-5}
17
+ # L4 safety: Qwen3.5-9B OOMed with static 2048 padding.
18
+ # Trainer now uses dynamic padding; 1536 cap drops only a few rows and gives margin.
19
+ MAX_LENGTH=${MAX_LENGTH:-1536}
20
+ LORA_R=${LORA_R:-32}
21
+ LORA_ALPHA=${LORA_ALPHA:-64}
22
+
23
+ export PYTORCH_CUDA_ALLOC_CONF=${PYTORCH_CUDA_ALLOC_CONF:-expandable_segments:True}
24
+ mkdir -p logs results data/v32_qwen35_9b_migration
25
+
26
+ echo "=== v32 Qwen3.5-9B migration config ==="
27
+ echo "base=$BASE"
28
+ echo "train_jsonl=$TRAIN_JSONL"
29
+ echo "adapter=$ADAPTER"
30
+ echo "epochs=$EPOCHS lr=$LR max_length=$MAX_LENGTH r=$LORA_R alpha=$LORA_ALPHA"
31
+
32
+ echo "=== build v32 Qwen3.5 migration dataset with v9/v30b anchors ==="
33
+ $PY scripts/build_v32_qwen35_migration_dataset.py \
34
+ --out "$TRAIN_JSONL" \
35
+ --repo "$REPO" \
36
+ --v31-train data/v31_general_external/v31_general_external_train.jsonl \
37
+ --v30b-train data/v30b_delta_distill/v30b_delta_distill_train.jsonl \
38
+ --v9-build "$REPO/build-v9-auto-direct-spec-n1" \
39
+ --v30b-build "$REPO/build-v30b-delta-distilled-direct-spec-n1" \
40
+ 2>&1 | tee logs/v32_qwen35_build_dataset.log
41
+
42
+ echo "=== train v32 Qwen3.5-9B Verilog adapter ==="
43
+ if [[ -d "$ADAPTER" && "${FORCE_TRAIN:-0}" != "1" ]]; then
44
+ echo "skip train: $ADAPTER exists"
45
+ else
46
+ $PY src/train_correction_adapter_any.py \
47
+ --base "$BASE" \
48
+ --train-jsonl "$TRAIN_JSONL" \
49
+ --output "$ADAPTER" \
50
+ --epochs "$EPOCHS" --lr "$LR" --max-length "$MAX_LENGTH" \
51
+ --batch-size 1 --grad-accum 4 --warmup-steps 40 \
52
+ --lora-r "$LORA_R" --lora-alpha "$LORA_ALPHA" \
53
+ --drop-overlength \
54
+ 2>&1 | tee logs/train_v32_qwen35_9b_verilog_general.log
55
+ fi
56
+
57
+ echo "=== eval v32 Qwen3.5 VerilogEval direct ==="
58
+ if [[ -f "$BUILD/direct_summary.json" && "${FORCE_EVAL:-0}" != "1" ]]; then
59
+ cat "$BUILD/direct_summary.json"
60
+ else
61
+ $PY scripts/run_verilogeval_v2_local_any.py \
62
+ --base "$BASE" \
63
+ --repo "$REPO" \
64
+ --build "$BUILD" \
65
+ --adapter "/home/pablo/verilog-llm/$ADAPTER" \
66
+ --temperature 0 --top_p 0.01 --max_new_tokens 1536 \
67
+ 2>&1 | tee logs/eval_v32_qwen35_verilogeval_generate.log
68
+
69
+ $PY scripts/score_direct_build.py \
70
+ --repo "$REPO" \
71
+ --build "$BUILD" \
72
+ 2>&1 | tee logs/eval_v32_qwen35_verilogeval_score.log
73
+ fi
74
+
75
+ echo "=== v32 qwen35 done ==="
76
+ cat "$BUILD/direct_summary.json"
qwen35-9b-verilog-migration-general-lora/scripts/train_correction_adapter_any.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Train LoRA/QLoRA Verilog adapter on causal or conditional-generation HF models.
3
+
4
+ This is a compatibility variant for bases such as Qwen3.5 VLM/text models that
5
+ are not loadable via AutoModelForCausalLM. For normal coder models,
6
+ `src/train_correction_adapter.py` remains the default.
7
+ """
8
+ import argparse
9
+ import json
10
+ from pathlib import Path
11
+
12
+ import torch
13
+ from datasets import Dataset
14
+ from peft import LoraConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training
15
+ from transformers import (
16
+ AutoConfig,
17
+ AutoModelForCausalLM,
18
+ AutoModelForImageTextToText,
19
+ AutoTokenizer,
20
+ BitsAndBytesConfig,
21
+ DataCollatorForLanguageModeling,
22
+ Trainer,
23
+ TrainingArguments,
24
+ )
25
+
26
+ SYSTEM = "You are an expert Verilog designer. Return only complete synthesizable Verilog code. No explanation."
27
+
28
+
29
+ def load_rows(path):
30
+ rows = []
31
+ with open(path) as f:
32
+ for line in f:
33
+ if line.strip():
34
+ r = json.loads(line)
35
+ if "spec" not in r or "code" not in r:
36
+ raise ValueError(f"JSONL row missing spec/code: {r.keys()}")
37
+ rows.append(r)
38
+ return rows
39
+
40
+
41
+ def format_rows(rows, tokenizer):
42
+ texts = []
43
+ for r in rows:
44
+ if "messages" in r:
45
+ msg = r["messages"]
46
+ else:
47
+ assistant = r.get("assistant")
48
+ if not assistant:
49
+ assistant = "```verilog\n" + r["code"].strip() + "\n```"
50
+ msg = [
51
+ {"role": "system", "content": r.get("system", SYSTEM)},
52
+ {"role": "user", "content": r.get("user", r["spec"])},
53
+ {"role": "assistant", "content": assistant},
54
+ ]
55
+ texts.append(tokenizer.apply_chat_template(msg, tokenize=False, add_generation_prompt=False))
56
+ return texts
57
+
58
+
59
+ def build_dataset(rows, tokenizer, max_length, drop_overlength):
60
+ texts = format_rows(rows, tokenizer)
61
+ if drop_overlength:
62
+ kept, dropped = [], 0
63
+ for text in texts:
64
+ if len(tokenizer(text)["input_ids"]) <= max_length:
65
+ kept.append(text)
66
+ else:
67
+ dropped += 1
68
+ if not kept:
69
+ raise ValueError(f"all rows exceed max_length={max_length}; dropped={dropped}")
70
+ print(f"drop_overlength kept={len(kept)} dropped={dropped} max_length={max_length}", flush=True)
71
+ texts = kept
72
+ ds = Dataset.from_dict({"text": texts})
73
+
74
+ def enc(batch):
75
+ # Dynamic padding in the collator avoids padding every row to max_length.
76
+ # This is important for Qwen3.5-9B on L4: static 2048 padding OOMs.
77
+ out = tokenizer(batch["text"], max_length=max_length, truncation=not drop_overlength, padding=False)
78
+ return out
79
+
80
+ return ds.map(enc, batched=True, remove_columns=["text"])
81
+
82
+
83
+ def model_loader_for(base):
84
+ cfg = AutoConfig.from_pretrained(base, trust_remote_code=True)
85
+ model_type = getattr(cfg, "model_type", "")
86
+ arch = " ".join(getattr(cfg, "architectures", []) or [])
87
+ if model_type in {"qwen3_5"} or "ForConditionalGeneration" in arch:
88
+ return AutoModelForImageTextToText
89
+ return AutoModelForCausalLM
90
+
91
+
92
+ def main():
93
+ ap = argparse.ArgumentParser()
94
+ ap.add_argument("--base", required=True)
95
+ ap.add_argument("--adapter-in", default=None)
96
+ ap.add_argument("--train-jsonl", required=True)
97
+ ap.add_argument("--output", required=True)
98
+ ap.add_argument("--epochs", type=float, default=0.8)
99
+ ap.add_argument("--lr", type=float, default=1e-5)
100
+ ap.add_argument("--max-length", type=int, default=2048)
101
+ ap.add_argument("--batch-size", type=int, default=1)
102
+ ap.add_argument("--grad-accum", type=int, default=4)
103
+ ap.add_argument("--warmup-steps", type=int, default=40)
104
+ ap.add_argument("--lora-r", type=int, default=32)
105
+ ap.add_argument("--lora-alpha", type=int, default=64)
106
+ ap.add_argument("--logging-steps", type=int, default=2)
107
+ ap.add_argument("--save-steps", type=int, default=0)
108
+ ap.add_argument("--drop-overlength", action="store_true")
109
+ args = ap.parse_args()
110
+
111
+ rows = load_rows(args.train_jsonl)
112
+ tok_source = args.adapter_in or args.base
113
+ tokenizer = AutoTokenizer.from_pretrained(tok_source, trust_remote_code=True)
114
+ if tokenizer.pad_token is None:
115
+ tokenizer.pad_token = tokenizer.eos_token
116
+ ds = build_dataset(rows, tokenizer, args.max_length, args.drop_overlength)
117
+
118
+ bnb = BitsAndBytesConfig(
119
+ load_in_4bit=True,
120
+ bnb_4bit_quant_type="nf4",
121
+ bnb_4bit_compute_dtype=torch.float16,
122
+ bnb_4bit_use_double_quant=True,
123
+ )
124
+ loader = model_loader_for(args.base)
125
+ model = loader.from_pretrained(
126
+ args.base,
127
+ quantization_config=bnb,
128
+ device_map="auto",
129
+ trust_remote_code=True,
130
+ )
131
+ model = prepare_model_for_kbit_training(model)
132
+
133
+ if args.adapter_in:
134
+ model = PeftModel.from_pretrained(model, args.adapter_in, is_trainable=True)
135
+ else:
136
+ cfg = LoraConfig(
137
+ r=args.lora_r,
138
+ lora_alpha=args.lora_alpha,
139
+ lora_dropout=0.05,
140
+ bias="none",
141
+ task_type="CAUSAL_LM",
142
+ target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
143
+ )
144
+ model = get_peft_model(model, cfg)
145
+
146
+ save_strategy = "no" if args.save_steps == 0 else "steps"
147
+ train_args = TrainingArguments(
148
+ output_dir=str(Path(args.output).with_name(Path(args.output).name + "_ckpt")),
149
+ num_train_epochs=args.epochs,
150
+ per_device_train_batch_size=args.batch_size,
151
+ gradient_accumulation_steps=args.grad_accum,
152
+ learning_rate=args.lr,
153
+ warmup_steps=args.warmup_steps,
154
+ logging_steps=args.logging_steps,
155
+ save_strategy=save_strategy,
156
+ save_steps=args.save_steps if args.save_steps else 500,
157
+ report_to="none",
158
+ fp16=True,
159
+ )
160
+ trainer = Trainer(
161
+ model=model,
162
+ args=train_args,
163
+ train_dataset=ds,
164
+ data_collator=DataCollatorForLanguageModeling(tokenizer, mlm=False),
165
+ )
166
+ trainer.train()
167
+ model.save_pretrained(args.output)
168
+ tokenizer.save_pretrained(args.output)
169
+ print(f"saved {args.output}")
170
+
171
+
172
+ if __name__ == "__main__":
173
+ main()
qwen35-9b-verilog-migration-general-lora/tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": false,
13
+ "local_files_only": false,
14
+ "model_max_length": 262144,
15
+ "model_specific_special_tokens": {
16
+ "audio_bos_token": "<|audio_start|>",
17
+ "audio_eos_token": "<|audio_end|>",
18
+ "audio_token": "<|audio_pad|>",
19
+ "image_token": "<|image_pad|>",
20
+ "video_token": "<|video_pad|>",
21
+ "vision_bos_token": "<|vision_start|>",
22
+ "vision_eos_token": "<|vision_end|>"
23
+ },
24
+ "pad_token": "<|endoftext|>",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "Qwen2Tokenizer",
28
+ "unk_token": null,
29
+ "video_token": "<|video_pad|>",
30
+ "vision_bos_token": "<|vision_start|>",
31
+ "vision_eos_token": "<|vision_end|>"
32
+ }
qwen35-9b-verilog-structured-repair-lora/.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
qwen35-9b-verilog-structured-repair-lora/README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3.5-9B
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - verilog
7
+ - rtl
8
+ - qwen3.5
9
+ - lora
10
+ - peft
11
+ - code-generation
12
+ - repair
13
+ ---
14
+
15
+ # Verilog Qwen3.5 9B v34 Manual Structured Repair LoRA
16
+
17
+ PEFT LoRA adapter for `Qwen/Qwen3.5-9B`, initialized from v33 and further trained on hand-written/manual repairs for v33 max4096 failures.
18
+
19
+ ## Important data note
20
+
21
+ This adapter was trained with manual repair targets only for the targeted v33 failure repairs. No converted VerilogEval `RefModule` reference-solution code was used as repair target code.
22
+
23
+ ## Intended format
24
+
25
+ ```text
26
+ Thinking:
27
+ [BEGIN]
28
+ module TopModule(...);
29
+ ...
30
+ endmodule
31
+ [DONE]
32
+ ```
33
+
34
+ Use code inside `[BEGIN]` / `[DONE]` as final artifact.
35
+
36
+ ## Evaluation in this project
37
+
38
+ Local VerilogEval v2 spec-to-RTL direct single-adapter eval, no retry, no selector, no compiler feedback before final answer:
39
+
40
+ ```text
41
+ v34 manual max2048: compile 103/156, pass 77/156 = 49.4%
42
+ ```
43
+
44
+ A max4096 eval is being run after publication request to test whether max token budget closes the gap with v33 max4096.
45
+
46
+ Interpretation: v34 manual is experimental. v33 remains the best confirmed clean single-adapter checkpoint until the max4096 v34 result is known.
47
+
48
+ ## Loading
49
+
50
+ ```python
51
+ from transformers import AutoModelForCausalLM, AutoTokenizer
52
+ from peft import PeftModel
53
+
54
+ base = "Qwen/Qwen3.5-9B"
55
+ adapter = "Pablo-Flores-Mollinedo/verilog-qwen3.5-9b-v34-manual-structured-repair-lora"
56
+
57
+ tok = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
58
+ model = AutoModelForCausalLM.from_pretrained(base, trust_remote_code=True, device_map="auto")
59
+ model = PeftModel.from_pretrained(model, adapter)
60
+ ```
61
+
62
+ ## Notes
63
+
64
+ - Adapter only; requires the base model license/weights.
65
+ - Generated RTL should be compiled and simulated before use.
66
+ - Benchmark scores are finite-testbench simulation results, not formal proof.
qwen35-9b-verilog-structured-repair-lora/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3.5-9B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 32,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "gate_proj",
34
+ "down_proj",
35
+ "o_proj",
36
+ "v_proj",
37
+ "k_proj",
38
+ "q_proj",
39
+ "up_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
qwen35-9b-verilog-structured-repair-lora/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
qwen35-9b-verilog-structured-repair-lora/tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": true,
13
+ "local_files_only": false,
14
+ "model_max_length": 262144,
15
+ "model_specific_special_tokens": {
16
+ "audio_bos_token": "<|audio_start|>",
17
+ "audio_eos_token": "<|audio_end|>",
18
+ "audio_token": "<|audio_pad|>",
19
+ "image_token": "<|image_pad|>",
20
+ "video_token": "<|video_pad|>",
21
+ "vision_bos_token": "<|vision_start|>",
22
+ "vision_eos_token": "<|vision_end|>"
23
+ },
24
+ "pad_token": "<|endoftext|>",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "Qwen2Tokenizer",
28
+ "unk_token": null,
29
+ "video_token": "<|video_pad|>",
30
+ "vision_bos_token": "<|vision_start|>",
31
+ "vision_eos_token": "<|vision_end|>"
32
+ }
qwen35-9b-verilog-thinking-reinforced-lora/README.md ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3.5-9B
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - verilog
7
+ - rtl
8
+ - code-generation
9
+ - qwen3.5
10
+ - qwen
11
+ - lora
12
+ - peft
13
+ - qlora
14
+ - hardware
15
+ - verilog-eval
16
+ license: apache-2.0
17
+ ---
18
+
19
+ # Verilog Qwen3.5-9B v33 Thinking-Reinforced LoRA
20
+
21
+ `adapter_v33_qwen35_thinking_compile_functional_reinforced` is a standard PEFT LoRA adapter for `Qwen/Qwen3.5-9B`, focused on Verilog RTL generation.
22
+
23
+ It fine-tunes from the v32 Qwen3.5 adapter, keeps brief reasoning/thinking behavior, and reinforces compile + functional correctness using detailed v32 failure analysis plus verified v9/v30b/v29 repairs.
24
+
25
+ ## Important caveat
26
+
27
+ This is **not a clean zero-shot VerilogEval leaderboard model**. The dataset includes benchmark-targeted verified outputs and repair anchors from earlier adapters/pipelines. Treat the VerilogEval score as an experiment result, not as a contamination-free leaderboard claim.
28
+
29
+ LoRA weights from Qwen2.5-Coder were not transferred. This adapter was trained directly on Qwen3.5-9B, then continued from the v32 Qwen3.5 LoRA.
30
+
31
+ ## Results
32
+
33
+ ### VerilogEval v2 direct, spec-to-RTL, n=1, temperature 0
34
+
35
+ | Model / system | Compile | Functional pass |
36
+ |---|---:|---:|
37
+ | v9 prior Qwen2.5-Coder single adapter | — | 67/156 |
38
+ | v30b prior best Qwen2.5-Coder single adapter | 141/156 | 71/156 |
39
+ | v32 Qwen3.5 migration | 71/156 | 60/156 |
40
+ | v29 multi-adapter verifier selector | 150/156 | 84/156 |
41
+ | **v33 Qwen3.5 thinking-reinforced single adapter** | **101/156** | **76/156** |
42
+
43
+ v33 is the first Qwen3.5 single adapter in this project to beat v30b on VerilogEval direct functional pass:
44
+
45
+ ```text
46
+ v32 -> v33: +30 compile, +16 pass
47
+ v30b -> v33: -40 compile, +5 pass
48
+ ```
49
+
50
+ Compile rate is still lower than v30b, but v33 has more functional wins and stronger reasoning diversity.
51
+
52
+ ## What changed from v32
53
+
54
+ v32 often failed because it reasoned at length but did not reliably finish with clean compileable Verilog. v33 keeps thinking, but trains a structured final-answer pattern:
55
+
56
+ ```text
57
+ Thinking:
58
+ - exact interface checks
59
+ - category-specific pitfalls
60
+ - previous failure-specific warning
61
+ - final sanity check
62
+
63
+ [BEGIN]
64
+ <one complete synthesizable TopModule>
65
+ [DONE]
66
+ ```
67
+
68
+ ## Failure analysis used for training
69
+
70
+ v32 failure analysis summary:
71
+
72
+ ```text
73
+ pass: 60
74
+ no_module_or_extracted_junk:60
75
+ syntax_compile: 14
76
+ functional_mismatch: 11
77
+ duplicate_module_or_decl: 6
78
+ compile_error_other: 4
79
+ undeclared_or_bad_identifier:1
80
+ ```
81
+
82
+ Category pass/compile showed especially weak seq/FSM/K-map compile stability, so v33 reinforces those with verified repairs and anchors.
83
+
84
+ ## Training data mix
85
+
86
+ Dataset builder: `scripts/build_v33_qwen35_thinking_reinforce_dataset.py`
87
+
88
+ Unique source counts:
89
+
90
+ - 32 v32 failed-repair rows using verified v30b/v9/v29 solutions.
91
+ - 14 Qwen3.5 unique-win retention rows.
92
+ - 71 v30b pass anchors.
93
+ - 67 v9 pass anchors.
94
+ - 84 v29 selector pass anchors.
95
+ - 35 external/general rows.
96
+ - 493 clean verified rows.
97
+ - 316 synthetic verified rows.
98
+
99
+ Default repeat weights:
100
+
101
+ ```text
102
+ v32 failed repair: 36x
103
+ v32 unique wins: 24x
104
+ v30b pass anchor: 8x
105
+ v9 pass anchor: 6x
106
+ v29 selector anchor: 3x
107
+ external verified: 8x
108
+ clean verified: 2x
109
+ synthetic verified: 1x
110
+ ```
111
+
112
+ Training used `--drop-overlength`; overlength rows were dropped, not truncated.
113
+
114
+ ## Training hyperparameters
115
+
116
+ ```text
117
+ base model: Qwen/Qwen3.5-9B
118
+ base adapter: adapter_v32_qwen35_9b_verilog_general
119
+ method: QLoRA/LoRA continuation
120
+ LoRA r: 32
121
+ LoRA alpha: 64
122
+ learning rate: 8e-6
123
+ epochs: 0.50
124
+ max length: 1536
125
+ batch size: 1
126
+ grad accum: 4
127
+ warmup steps: 30
128
+ ```
129
+
130
+ ## Usage
131
+
132
+ Qwen3.5 uses a conditional-generation loader in the current Transformers stack.
133
+
134
+ ```python
135
+ import torch
136
+ from transformers import AutoTokenizer, AutoModelForImageTextToText, BitsAndBytesConfig
137
+ from peft import PeftModel
138
+
139
+ base = "Qwen/Qwen3.5-9B"
140
+ adapter = "Pablo-Flores-Mollinedo/verilog-qwen3.5-9b-v33-thinking-reinforced-lora"
141
+
142
+ bnb = BitsAndBytesConfig(
143
+ load_in_4bit=True,
144
+ bnb_4bit_quant_type="nf4",
145
+ bnb_4bit_compute_dtype=torch.bfloat16,
146
+ bnb_4bit_use_double_quant=True,
147
+ )
148
+
149
+ tok = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
150
+ model = AutoModelForImageTextToText.from_pretrained(
151
+ base,
152
+ quantization_config=bnb,
153
+ device_map="auto",
154
+ trust_remote_code=True,
155
+ )
156
+ model = PeftModel.from_pretrained(model, adapter)
157
+ model.eval()
158
+
159
+ prompt = "Write module TopModule(input a, input b, output out); out should be a & b."
160
+ messages = [
161
+ {"role": "system", "content": "You are a Verilog RTL designer. You may reason briefly, then put only final compileable Verilog code inside [BEGIN]/[DONE]."},
162
+ {"role": "user", "content": prompt},
163
+ ]
164
+ text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
165
+ inputs = tok(text, return_tensors="pt").to(model.device)
166
+ with torch.no_grad():
167
+ out = model.generate(**inputs, max_new_tokens=1024, do_sample=False, pad_token_id=tok.eos_token_id)
168
+ print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
169
+ ```
170
+
171
+ ## Related artifacts
172
+
173
+ - v32 Qwen3.5 migration: earlier checkpoint, 60/156 pass.
174
+ - v30b Qwen2.5-Coder LoRA: prior best single adapter, 71/156 pass.
175
+ - v29 verifier selector: best practical pipeline, 84/156 pass.
176
+
177
+ ## Intended use
178
+
179
+ Research and experimentation with Verilog RTL generation. Always compile, simulate, lint, and review generated RTL before use.
qwen35-9b-verilog-thinking-reinforced-lora/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3.5-9B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 32,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "o_proj",
34
+ "down_proj",
35
+ "gate_proj",
36
+ "up_proj",
37
+ "v_proj",
38
+ "q_proj",
39
+ "k_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
qwen35-9b-verilog-thinking-reinforced-lora/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
qwen35-9b-verilog-thinking-reinforced-lora/data/dataset_summary.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "output": "data/v33_qwen35_thinking_reinforce/v33_qwen35_thinking_reinforce_train.jsonl",
3
+ "rows": 4292,
4
+ "unique": {
5
+ "v32_failed_repair": 32,
6
+ "v32_unique_win_retention": 14,
7
+ "external": 35,
8
+ "clean": 493,
9
+ "synthetic": 316
10
+ },
11
+ "anchor_unique_repeat": [
12
+ [
13
+ "v30b_pass_anchor",
14
+ 71,
15
+ 8
16
+ ],
17
+ [
18
+ "v9_pass_anchor",
19
+ 67,
20
+ 6
21
+ ],
22
+ [
23
+ "v29_selector_pass_anchor",
24
+ 84,
25
+ 3
26
+ ]
27
+ ],
28
+ "repeat_policy": {
29
+ "v32_failed_repair": 36,
30
+ "v32_unique_win_retention": 24,
31
+ "v30b_pass_anchor": 8,
32
+ "v9_pass_anchor": 6,
33
+ "v29_selector_pass_anchor": 3,
34
+ "external": 8,
35
+ "clean": 2,
36
+ "synthetic": 1
37
+ },
38
+ "notes": "Thinking preserved. Focus: v32 failures fixed by verified v30b/v9/v29 outputs, plus compile/functional retention and Qwen3.5 unique wins."
39
+ }
qwen35-9b-verilog-thinking-reinforced-lora/documentation/v33_qwen35_thinking_reinforce_plan.md ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v33 Qwen3.5 thinking compile/functional reinforcement plan
2
+
3
+ Goal: keep Qwen3.5 reasoning/thinking behavior, but repair the main v32 weakness: low compile rate and lost easy VerilogEval anchors.
4
+
5
+ ## Starting point
6
+
7
+ v32 Qwen3.5-9B migration finished:
8
+
9
+ ```text
10
+ compile: 71/156
11
+ pass: 60/156
12
+ ```
13
+
14
+ Comparison:
15
+
16
+ ```text
17
+ v9: 67/156 pass
18
+ v30b: 71/156 pass
19
+ ```
20
+
21
+ v32 is not a better single adapter, but it has useful diversity:
22
+
23
+ ```text
24
+ wins vs v9: 10
25
+ wins vs v30b: 12
26
+ ```
27
+
28
+ The problem is mostly compile/alignment, not lack of reasoning capacity:
29
+
30
+ ```text
31
+ v32 compile: 71/156
32
+ v30b compile: 141/156
33
+ ```
34
+
35
+ ## User direction
36
+
37
+ Do **not** remove thinking. Instead:
38
+
39
+ - preserve thinking/reasoning,
40
+ - inspect each failed example in detail,
41
+ - reinforce compile correctness,
42
+ - reinforce functional correctness,
43
+ - use curated and varied verified examples.
44
+
45
+ ## New files
46
+
47
+ ```text
48
+ scripts/analyze_v32_qwen35_failures.py
49
+ scripts/build_v33_qwen35_thinking_reinforce_dataset.py
50
+ scripts/run_v33_qwen35_thinking_reinforce.sh
51
+ ```
52
+
53
+ Also updated:
54
+
55
+ ```text
56
+ src/train_correction_adapter_any.py
57
+ scripts/run_verilogeval_v2_local_any.py
58
+ ```
59
+
60
+ ## Failure analysis
61
+
62
+ The analyzer scores every v32 output and writes:
63
+
64
+ ```text
65
+ results/v32_qwen35_failure_analysis/summary.json
66
+ results/v32_qwen35_failure_analysis/failure_rows.jsonl
67
+ results/v32_qwen35_failure_analysis/failure_analysis.md
68
+ ```
69
+
70
+ For each problem it records:
71
+
72
+ - category,
73
+ - compile/pass,
74
+ - failure class,
75
+ - first compile/sim error,
76
+ - module/endmodule counts,
77
+ - response length,
78
+ - thinking/tag indicators,
79
+ - whether v9/v30b/v29 passed,
80
+ - best verified source for repair.
81
+
82
+ Failure classes include:
83
+
84
+ ```text
85
+ no_module_or_extracted_junk
86
+ truncated_missing_endmodule
87
+ syntax_compile
88
+ undeclared_or_bad_identifier
89
+ declaration_or_assignment_error
90
+ compile_error_other
91
+ functional_mismatch
92
+ ```
93
+
94
+ ## Training strategy
95
+
96
+ v33 fine-tunes from v32:
97
+
98
+ ```text
99
+ base: Qwen/Qwen3.5-9B
100
+ adapter-in: adapter_v32_qwen35_9b_verilog_general
101
+ output: adapter_v33_qwen35_thinking_compile_functional_reinforced
102
+ ```
103
+
104
+ Dataset uses thinking-form assistant targets:
105
+
106
+ ```text
107
+ Thinking:
108
+ - short implementation checks
109
+ - category-specific pitfalls
110
+ - previous failure-specific warning
111
+ - final sanity check
112
+
113
+ [BEGIN]
114
+ <verified Verilog>
115
+ [DONE]
116
+ ```
117
+
118
+ This is not anti-thinking. It is structured thinking with clean final code.
119
+
120
+ ## Reinforcement sources
121
+
122
+ 1. **v32 failed repair rows**
123
+ - For each v32 failed problem, use strongest verified generated solution available:
124
+ 1. v30b pass output,
125
+ 2. else v9 pass output,
126
+ 3. else v29 selector pass output.
127
+ - High repeat weight.
128
+
129
+ 2. **v32 unique wins**
130
+ - Preserve Qwen3.5 problems that v9/v30b missed.
131
+ - Prevent regression to v30b-only behavior.
132
+
133
+ 3. **v30b/v9/v29 anchors**
134
+ - Keep local optimum and selector improvements.
135
+
136
+ 4. **External/clean/synthetic verified rows**
137
+ - Keep diversity and reduce VerilogEval-only overfit.
138
+
139
+ ## Default repeat policy
140
+
141
+ ```text
142
+ v32_failed_repair: 36x
143
+ v32_unique_win_retention: 24x
144
+ v30b_pass_anchor: 8x
145
+ v9_pass_anchor: 6x
146
+ v29_selector_pass_anchor: 3x
147
+ external verified: 8x
148
+ clean verified: 2x
149
+ synthetic verified: 1x
150
+ ```
151
+
152
+ ## Training defaults
153
+
154
+ ```text
155
+ epochs: 0.50
156
+ lr: 8e-6
157
+ max_length: 1536
158
+ batch: 1
159
+ grad_accum: 4
160
+ warmup_steps: 30
161
+ ```
162
+
163
+ Expected training time on L4: about 1.5–2.5 hours depending on dropped rows.
164
+
165
+ ## Evaluation defaults
166
+
167
+ ```text
168
+ allow-thinking: true
169
+ max_new_tokens: 1024
170
+ temperature: 0
171
+ top_p: 0.01
172
+ ```
173
+
174
+ Prompt allows brief reasoning, but requires final Verilog only inside `[BEGIN]/[DONE]`.
175
+
176
+ ## Acceptance target
177
+
178
+ Useful v33 if:
179
+
180
+ ```text
181
+ compile improves materially over v32 71/156
182
+ pass improves over v32 60/156
183
+ keeps some v32 unique wins
184
+ ```
185
+
186
+ Strong target:
187
+
188
+ ```text
189
+ pass >= v9 67/156
190
+ compile much closer to v30b
191
+ ```
192
+
193
+ Best-case target:
194
+
195
+ ```text
196
+ pass >= v30b 71/156
197
+ ```
qwen35-9b-verilog-thinking-reinforced-lora/results/v32_failure_analysis/failure_analysis.md ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # v32 Qwen3.5 failure analysis
2
+
3
+ ## Summary
4
+
5
+ ```json
6
+ {
7
+ "total": 156,
8
+ "compile": 71,
9
+ "passed": 60,
10
+ "failure_class_counts": {
11
+ "pass": 60,
12
+ "syntax_compile": 14,
13
+ "no_module_or_extracted_junk": 60,
14
+ "functional_mismatch": 11,
15
+ "compile_error_other": 4,
16
+ "duplicate_module_or_decl": 6,
17
+ "undeclared_or_bad_identifier": 1
18
+ },
19
+ "category_counts": {
20
+ "comb_vector": 45,
21
+ "arith_datapath": 17,
22
+ "counter_timer": 15,
23
+ "seq_shift": 31,
24
+ "case_kmap": 10,
25
+ "fsm_protocol": 38
26
+ },
27
+ "category_pass": {
28
+ "comb_vector": 28,
29
+ "counter_timer": 8,
30
+ "seq_shift": 6,
31
+ "case_kmap": 1,
32
+ "fsm_protocol": 5,
33
+ "arith_datapath": 12,
34
+ "other": 0
35
+ },
36
+ "category_compile": {
37
+ "comb_vector": 32,
38
+ "counter_timer": 8,
39
+ "seq_shift": 9,
40
+ "case_kmap": 1,
41
+ "fsm_protocol": 9,
42
+ "arith_datapath": 12,
43
+ "other": 0
44
+ },
45
+ "fix_source_counts": {
46
+ "v30b": 23,
47
+ "none": 64,
48
+ "v29_selector": 5,
49
+ "v9": 4
50
+ },
51
+ "wins_vs_v9": [
52
+ "Prob028_m2014_q4a",
53
+ "Prob045_edgedetect2",
54
+ "Prob047_dff8ar",
55
+ "Prob079_fsm3onehot",
56
+ "Prob097_mux9to1v",
57
+ "Prob114_bugs_case",
58
+ "Prob119_fsm3",
59
+ "Prob127_lemmings1",
60
+ "Prob130_circuit5",
61
+ "Prob132_always_if2"
62
+ ],
63
+ "wins_vs_v30b": [
64
+ "Prob019_m2014_q4f",
65
+ "Prob033_ece241_2014_q1c",
66
+ "Prob045_edgedetect2",
67
+ "Prob047_dff8ar",
68
+ "Prob069_truthtable1",
69
+ "Prob079_fsm3onehot",
70
+ "Prob114_bugs_case",
71
+ "Prob118_history_shift",
72
+ "Prob119_fsm3",
73
+ "Prob127_lemmings1",
74
+ "Prob130_circuit5",
75
+ "Prob132_always_if2"
76
+ ],
77
+ "losses_vs_v9": [
78
+ "Prob003_step_one",
79
+ "Prob004_vector2",
80
+ "Prob006_vectorr",
81
+ "Prob023_vector100r",
82
+ "Prob026_alwaysblock1",
83
+ "Prob039_always_if",
84
+ "Prob076_always_case",
85
+ "Prob095_review2015_fsmshift",
86
+ "Prob101_circuit4",
87
+ "Prob102_circuit3",
88
+ "Prob103_circuit2",
89
+ "Prob105_rotate100",
90
+ "Prob106_always_nolatches",
91
+ "Prob107_fsm1s",
92
+ "Prob109_fsm1",
93
+ "Prob126_circuit6",
94
+ "Prob128_fsm_ps2"
95
+ ],
96
+ "losses_vs_v30b": [
97
+ "Prob003_step_one",
98
+ "Prob004_vector2",
99
+ "Prob006_vectorr",
100
+ "Prob018_mux256to1",
101
+ "Prob023_vector100r",
102
+ "Prob026_alwaysblock1",
103
+ "Prob030_popcount255",
104
+ "Prob039_always_if",
105
+ "Prob042_vector4",
106
+ "Prob054_edgedetect",
107
+ "Prob056_ece241_2013_q7",
108
+ "Prob058_alwaysblock2",
109
+ "Prob060_m2014_q4k",
110
+ "Prob063_review2015_shiftcount",
111
+ "Prob075_counter_2bc",
112
+ "Prob076_always_case",
113
+ "Prob095_review2015_fsmshift",
114
+ "Prob103_circuit2",
115
+ "Prob106_always_nolatches",
116
+ "Prob109_fsm1",
117
+ "Prob126_circuit6",
118
+ "Prob128_fsm_ps2",
119
+ "Prob148_2013_q2afsm"
120
+ ]
121
+ }
122
+ ```
123
+
124
+ ## Failed problems
125
+
126
+ | problem | category | class | fix source | v9 | v30b | v29 | first error |
127
+ |---|---|---|---|---:|---:|---:|---|
128
+ | Prob003_step_one | comb_vector | syntax_compile | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
129
+ | Prob004_vector2 | comb_vector | no_module_or_extracted_junk | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
130
+ | Prob006_vectorr | comb_vector | functional_mismatch | v30b | 1 | 1 | 1 | Hint: Output 'out' has 203 mismatches. First mismatch occurred at time 20. |
131
+ | Prob009_popcount3 | counter_timer | syntax_compile | | 0 | 0 | 0 | dut.sv:1: syntax error |
132
+ | Prob018_mux256to1 | arith_datapath | no_module_or_extracted_junk | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
133
+ | Prob021_mux256to1v | comb_vector | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
134
+ | Prob023_vector100r | comb_vector | compile_error_other | v30b | 1 | 1 | 1 | dut.sv:2: error: part select in[0:99] is out of order. |
135
+ | Prob026_alwaysblock1 | comb_vector | duplicate_module_or_decl | v30b | 1 | 1 | 1 | dut.sv:3: error: out_alwaysblock is not a valid l-value in tb.top_module1. |
136
+ | Prob029_m2014_q4g | comb_vector | no_module_or_extracted_junk | | 0 | 0 | 0 | test.sv:6: syntax error |
137
+ | Prob030_popcount255 | counter_timer | no_module_or_extracted_junk | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
138
+ | Prob031_dff | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
139
+ | Prob034_dff8 | seq_shift | duplicate_module_or_decl | | 0 | 0 | 0 | dut.sv:2: error: q is not a valid l-value in tb.top_module1. |
140
+ | Prob039_always_if | comb_vector | syntax_compile | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
141
+ | Prob042_vector4 | arith_datapath | syntax_compile | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
142
+ | Prob046_dff8p | seq_shift | syntax_compile | | 0 | 0 | 0 | dut.sv:1: syntax error |
143
+ | Prob049_m2014_q4b | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
144
+ | Prob050_kmap1 | case_kmap | no_module_or_extracted_junk | v29_selector | 0 | 0 | 1 | dut.sv:1: syntax error |
145
+ | Prob053_m2014_q4d | seq_shift | syntax_compile | | 0 | 0 | 0 | dut.sv:1: syntax error |
146
+ | Prob054_edgedetect | seq_shift | no_module_or_extracted_junk | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
147
+ | Prob056_ece241_2013_q7 | seq_shift | no_module_or_extracted_junk | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
148
+ | Prob057_kmap2 | case_kmap | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
149
+ | Prob058_alwaysblock2 | seq_shift | duplicate_module_or_decl | v30b | 0 | 1 | 0 | dut.sv:4: error: out_always_comb is not a valid l-value in tb.top_module1. |
150
+ | Prob060_m2014_q4k | seq_shift | syntax_compile | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
151
+ | Prob062_bugs_mux2 | comb_vector | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'out' has 110 mismatches. First mismatch occurred at time 20. |
152
+ | Prob063_review2015_shiftcount | counter_timer | no_module_or_extracted_junk | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
153
+ | Prob064_vector3 | arith_datapath | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
154
+ | Prob066_edgecapture | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
155
+ | Prob068_countbcd | counter_timer | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
156
+ | Prob070_ece241_2013_q2 | arith_datapath | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
157
+ | Prob071_always_casez | case_kmap | syntax_compile | | 0 | 0 | 0 | dut.sv:1: syntax error |
158
+ | Prob074_ece241_2014_q4 | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
159
+ | Prob075_counter_2bc | counter_timer | no_module_or_extracted_junk | v30b | 0 | 1 | 1 | dut.sv:1: syntax error |
160
+ | Prob076_always_case | comb_vector | duplicate_module_or_decl | v30b | 1 | 1 | 1 | dut.sv:4: error: out is not a valid l-value in tb.top_module1. |
161
+ | Prob078_dualedge | seq_shift | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'q' has 113 mismatches. First mismatch occurred at time 10. |
162
+ | Prob082_lfsr32 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
163
+ | Prob084_ece241_2013_q12 | seq_shift | compile_error_other | | 0 | 0 | 0 | dut.sv:10: error: can not select part of scalar: A |
164
+ | Prob085_shift4 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
165
+ | Prob086_lfsr5 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
166
+ | Prob088_ece241_2014_q5b | fsm_protocol | no_module_or_extracted_junk | v29_selector | 0 | 0 | 1 | dut.sv:1: syntax error |
167
+ | Prob089_ece241_2014_q5a | fsm_protocol | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'z' has 28 mismatches. First mismatch occurred at time 20. |
168
+ | Prob091_2012_q2b | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
169
+ | Prob092_gatesv100 | comb_vector | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'out_both' has no mismatches. |
170
+ | Prob093_ece241_2014_q3 | case_kmap | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
171
+ | Prob094_gatesv | comb_vector | syntax_compile | | 0 | 0 | 0 | dut.sv:1: syntax error |
172
+ | Prob095_review2015_fsmshift | fsm_protocol | no_module_or_extracted_junk | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
173
+ | Prob096_review2015_fsmseq | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
174
+ | Prob098_circuit7 | seq_shift | no_module_or_extracted_junk | v29_selector | 0 | 0 | 1 | dut.sv:1: syntax error |
175
+ | Prob099_m2014_q6c | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
176
+ | Prob100_fsm3comb | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
177
+ | Prob101_circuit4 | comb_vector | functional_mismatch | v9 | 1 | 0 | 1 | Hint: Output 'q' has 33 mismatches. First mismatch occurred at time 40. |
178
+ | Prob102_circuit3 | case_kmap | no_module_or_extracted_junk | v9 | 1 | 0 | 1 | dut.sv:1: syntax error |
179
+ | Prob103_circuit2 | comb_vector | no_module_or_extracted_junk | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
180
+ | Prob104_mt2015_muxdff | seq_shift | compile_error_other | | 0 | 0 | 0 | test.sv:76: error: port ``q_in'' is not a port of top_module1. |
181
+ | Prob105_rotate100 | seq_shift | no_module_or_extracted_junk | v9 | 1 | 0 | 1 | dut.sv:1: syntax error |
182
+ | Prob106_always_nolatches | fsm_protocol | syntax_compile | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
183
+ | Prob107_fsm1s | fsm_protocol | duplicate_module_or_decl | v9 | 1 | 0 | 1 | dut.sv:19: error: out is not a valid l-value in tb.top_module1. |
184
+ | Prob108_rule90 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
185
+ | Prob109_fsm1 | fsm_protocol | syntax_compile | v30b | 1 | 1 | 1 | dut.sv:1: syntax error |
186
+ | Prob112_always_case2 | case_kmap | syntax_compile | | 0 | 0 | 0 | dut.sv:1: syntax error |
187
+ | Prob113_2012_q1g | case_kmap | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
188
+ | Prob115_shift18 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
189
+ | Prob116_m2014_q3 | arith_datapath | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
190
+ | Prob117_circuit9 | seq_shift | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'q' has 244 mismatches. First mismatch occurred at time 10. |
191
+ | Prob120_fsm3s | fsm_protocol | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'out' has 56 mismatches. First mismatch occurred at time 20. |
192
+ | Prob121_2014_q3bfsm | fsm_protocol | undeclared_or_bad_identifier | v29_selector | 0 | 0 | 1 | dut.sv:13: error: Could not find variable ``y_next'' in ``tb.top_module1'' |
193
+ | Prob122_kmap4 | case_kmap | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
194
+ | Prob124_rule110 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
195
+ | Prob125_kmap3 | case_kmap | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
196
+ | Prob126_circuit6 | comb_vector | duplicate_module_or_decl | v30b | 1 | 1 | 1 | dut.sv:4: error: q is not a valid l-value in tb.top_module1. |
197
+ | Prob128_fsm_ps2 | fsm_protocol | functional_mismatch | v30b | 1 | 1 | 1 | Hint: Output 'done' has 173 mismatches. First mismatch occurred at time 210. |
198
+ | Prob129_ece241_2013_q8 | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
199
+ | Prob131_mt2015_q4 | comb_vector | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
200
+ | Prob133_2014_q3fsm | fsm_protocol | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'z' has 170 mismatches. First mismatch occurred at time 110. |
201
+ | Prob134_2014_q3c | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
202
+ | Prob135_m2014_q6b | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
203
+ | Prob136_m2014_q6 | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
204
+ | Prob137_fsm_serial | fsm_protocol | syntax_compile | | 0 | 0 | 0 | dut.sv:3: syntax error |
205
+ | Prob138_2012_q2fsm | fsm_protocol | no_module_or_extracted_junk | v29_selector | 0 | 0 | 1 | dut.sv:1: syntax error |
206
+ | Prob139_2013_q2bfsm | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
207
+ | Prob140_fsm_hdlc | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
208
+ | Prob141_count_clock | counter_timer | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
209
+ | Prob142_lemmings2 | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
210
+ | Prob143_fsm_onehot | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
211
+ | Prob144_conwaylife | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
212
+ | Prob145_circuit8 | seq_shift | functional_mismatch | | 0 | 0 | 0 | Hint: Output 'p' has 112 mismatches. First mismatch occurred at time 90. |
213
+ | Prob146_fsm_serialdata | fsm_protocol | syntax_compile | | 0 | 0 | 0 | dut.sv:3: syntax error |
214
+ | Prob147_circuit10 | seq_shift | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
215
+ | Prob148_2013_q2afsm | fsm_protocol | no_module_or_extracted_junk | v30b | 0 | 1 | 0 | dut.sv:1: syntax error |
216
+ | Prob149_ece241_2013_q4 | comb_vector | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
217
+ | Prob150_review2015_fsmonehot | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
218
+ | Prob151_review2015_fsm | fsm_protocol | compile_error_other | | 0 | 0 | 0 | 7 error(s) during elaboration. |
219
+ | Prob152_lemmings3 | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
220
+ | Prob153_gshare | counter_timer | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
221
+ | Prob154_fsm_ps2data | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
222
+ | Prob155_lemmings4 | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
223
+ | Prob156_review2015_fancytimer | fsm_protocol | no_module_or_extracted_junk | | 0 | 0 | 0 | dut.sv:1: syntax error |
qwen35-9b-verilog-thinking-reinforced-lora/results/v32_failure_analysis/failure_rows.jsonl ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"problem": "Prob001_zero", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'zero' has no mismatches.", "code_chars": 70, "code_lines": 3, "full_response_chars": 5598, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
2
+ {"problem": "Prob002_m2014_q4i", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 71, "code_lines": 3, "full_response_chars": 5719, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
3
+ {"problem": "Prob003_step_one", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 25, "code_lines": 2, "full_response_chars": 5748, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
4
+ {"problem": "Prob004_vector2", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4060, "code_lines": 56, "full_response_chars": 4106, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
5
+ {"problem": "Prob005_notgate", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 72, "code_lines": 3, "full_response_chars": 4642, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
6
+ {"problem": "Prob006_vectorr", "category": "comb_vector", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'out' has 203 mismatches. First mismatch occurred at time 20.", "code_chars": 145, "code_lines": 3, "full_response_chars": 4290, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
7
+ {"problem": "Prob007_wire", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 79, "code_lines": 3, "full_response_chars": 5739, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
8
+ {"problem": "Prob008_m2014_q4h", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 79, "code_lines": 3, "full_response_chars": 5713, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
9
+ {"problem": "Prob009_popcount3", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 4241, "code_lines": 53, "full_response_chars": 4318, "has_begin_done": false, "has_thinking": false, "module_count": 6, "endmodule_count": 2, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
10
+ {"problem": "Prob010_mt2015_q4a", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'z' has no mismatches.", "code_chars": 82, "code_lines": 3, "full_response_chars": 2783, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
11
+ {"problem": "Prob011_norgate", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 93, "code_lines": 3, "full_response_chars": 5597, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
12
+ {"problem": "Prob012_xnorgate", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 85, "code_lines": 3, "full_response_chars": 3187, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
13
+ {"problem": "Prob013_m2014_q4e", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 93, "code_lines": 3, "full_response_chars": 3851, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
14
+ {"problem": "Prob014_andgate", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 80, "code_lines": 3, "full_response_chars": 3201, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
15
+ {"problem": "Prob015_vector1", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out_hi' has no mismatches.", "code_chars": 142, "code_lines": 4, "full_response_chars": 2122, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
16
+ {"problem": "Prob016_m2014_q4j", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'sum' has no mismatches.", "code_chars": 116, "code_lines": 3, "full_response_chars": 5890, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
17
+ {"problem": "Prob017_mux2to1v", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 120, "code_lines": 3, "full_response_chars": 3856, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
18
+ {"problem": "Prob018_mux256to1", "category": "arith_datapath", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5828, "code_lines": 24, "full_response_chars": 5893, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
19
+ {"problem": "Prob019_m2014_q4f", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 89, "code_lines": 3, "full_response_chars": 1850, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
20
+ {"problem": "Prob020_mt2015_eq2", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'z' has no mismatches.", "code_chars": 101, "code_lines": 3, "full_response_chars": 5232, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
21
+ {"problem": "Prob021_mux256to1v", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4340, "code_lines": 49, "full_response_chars": 4383, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
22
+ {"problem": "Prob022_mux2to1", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 99, "code_lines": 3, "full_response_chars": 3825, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
23
+ {"problem": "Prob023_vector100r", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "compile_error_other", "first_error": "dut.sv:2: error: part select in[0:99] is out of order.", "code_chars": 91, "code_lines": 3, "full_response_chars": 4065, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
24
+ {"problem": "Prob024_hadd", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'sum' has no mismatches.", "code_chars": 132, "code_lines": 4, "full_response_chars": 5536, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
25
+ {"problem": "Prob025_reduction", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'parity' has no mismatches.", "code_chars": 84, "code_lines": 3, "full_response_chars": 2121, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
26
+ {"problem": "Prob026_alwaysblock1", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "duplicate_module_or_decl", "first_error": "dut.sv:3: error: out_alwaysblock is not a valid l-value in tb.top_module1.", "code_chars": 169, "code_lines": 4, "full_response_chars": 5776, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
27
+ {"problem": "Prob027_fadd", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'cout' has no mismatches.", "code_chars": 169, "code_lines": 4, "full_response_chars": 5478, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
28
+ {"problem": "Prob028_m2014_q4a", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 148, "code_lines": 5, "full_response_chars": 5559, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
29
+ {"problem": "Prob029_m2014_q4g", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "test.sv:6: syntax error", "code_chars": 1540, "code_lines": 1, "full_response_chars": 1539, "has_begin_done": false, "has_thinking": false, "module_count": 0, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
30
+ {"problem": "Prob030_popcount255", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5344, "code_lines": 43, "full_response_chars": 5379, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
31
+ {"problem": "Prob031_dff", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5791, "code_lines": 46, "full_response_chars": 5900, "has_begin_done": false, "has_thinking": true, "module_count": 10, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
32
+ {"problem": "Prob032_vector0", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'outv' has no mismatches.", "code_chars": 192, "code_lines": 6, "full_response_chars": 4728, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
33
+ {"problem": "Prob033_ece241_2014_q1c", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 's' has no mismatches.", "code_chars": 169, "code_lines": 4, "full_response_chars": 1501, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
34
+ {"problem": "Prob034_dff8", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "duplicate_module_or_decl", "first_error": "dut.sv:2: error: q is not a valid l-value in tb.top_module1.", "code_chars": 112, "code_lines": 3, "full_response_chars": 5360, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
35
+ {"problem": "Prob035_count1to10", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 228, "code_lines": 7, "full_response_chars": 4975, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
36
+ {"problem": "Prob036_ringer", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'ringer' has no mismatches.", "code_chars": 173, "code_lines": 4, "full_response_chars": 1530, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
37
+ {"problem": "Prob037_review2015_count1k", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 235, "code_lines": 7, "full_response_chars": 4825, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
38
+ {"problem": "Prob038_count15", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 170, "code_lines": 6, "full_response_chars": 1288, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
39
+ {"problem": "Prob039_always_if", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 25, "code_lines": 2, "full_response_chars": 5352, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
40
+ {"problem": "Prob040_count10", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 233, "code_lines": 7, "full_response_chars": 4852, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
41
+ {"problem": "Prob041_dff8r", "category": "seq_shift", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 178, "code_lines": 6, "full_response_chars": 4149, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
42
+ {"problem": "Prob042_vector4", "category": "arith_datapath", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 25, "code_lines": 2, "full_response_chars": 5315, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
43
+ {"problem": "Prob043_vector5", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 861, "code_lines": 27, "full_response_chars": 3722, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
44
+ {"problem": "Prob044_vectorgates", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out_or_bitwise' has no mismatches.", "code_chars": 297, "code_lines": 6, "full_response_chars": 4484, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
45
+ {"problem": "Prob045_edgedetect2", "category": "seq_shift", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'anyedge' has no mismatches.", "code_chars": 196, "code_lines": 8, "full_response_chars": 2212, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
46
+ {"problem": "Prob046_dff8p", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 25, "code_lines": 2, "full_response_chars": 5295, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
47
+ {"problem": "Prob047_dff8ar", "category": "seq_shift", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 218, "code_lines": 6, "full_response_chars": 5364, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
48
+ {"problem": "Prob048_m2014_q4c", "category": "seq_shift", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 162, "code_lines": 7, "full_response_chars": 5233, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
49
+ {"problem": "Prob049_m2014_q4b", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 6588, "code_lines": 67, "full_response_chars": 6587, "has_begin_done": false, "has_thinking": true, "module_count": 0, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
50
+ {"problem": "Prob050_kmap1", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3488, "code_lines": 84, "full_response_chars": 3534, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v29_selector"}
51
+ {"problem": "Prob051_gates4", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out_and' has no mismatches.", "code_chars": 184, "code_lines": 5, "full_response_chars": 5084, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
52
+ {"problem": "Prob052_gates100", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out_and' has no mismatches.", "code_chars": 179, "code_lines": 5, "full_response_chars": 5309, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
53
+ {"problem": "Prob053_m2014_q4d", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 2901, "code_lines": 53, "full_response_chars": 2940, "has_begin_done": true, "has_thinking": true, "module_count": 7, "endmodule_count": 3, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
54
+ {"problem": "Prob054_edgedetect", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4884, "code_lines": 63, "full_response_chars": 4993, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
55
+ {"problem": "Prob055_conditional", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'min' has no mismatches.", "code_chars": 275, "code_lines": 8, "full_response_chars": 4962, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
56
+ {"problem": "Prob056_ece241_2013_q7", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4640, "code_lines": 77, "full_response_chars": 5375, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
57
+ {"problem": "Prob057_kmap2", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3126, "code_lines": 90, "full_response_chars": 3157, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
58
+ {"problem": "Prob058_alwaysblock2", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "duplicate_module_or_decl", "first_error": "dut.sv:4: error: out_always_comb is not a valid l-value in tb.top_module1.", "code_chars": 270, "code_lines": 9, "full_response_chars": 3635, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": false, "passed": false}}, "fix_source": "v30b"}
59
+ {"problem": "Prob059_wire4", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'w' has no mismatches.", "code_chars": 167, "code_lines": 6, "full_response_chars": 1025, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
60
+ {"problem": "Prob060_m2014_q4k", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 5501, "code_lines": 32, "full_response_chars": 5800, "has_begin_done": false, "has_thinking": true, "module_count": 5, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
61
+ {"problem": "Prob061_2014_q4a", "category": "seq_shift", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'Q' has no mismatches.", "code_chars": 180, "code_lines": 6, "full_response_chars": 4786, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
62
+ {"problem": "Prob062_bugs_mux2", "category": "comb_vector", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'out' has 110 mismatches. First mismatch occurred at time 20.", "code_chars": 212, "code_lines": 8, "full_response_chars": 5091, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
63
+ {"problem": "Prob063_review2015_shiftcount", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5015, "code_lines": 11, "full_response_chars": 5147, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
64
+ {"problem": "Prob064_vector3", "category": "arith_datapath", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4213, "code_lines": 9, "full_response_chars": 4256, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
65
+ {"problem": "Prob065_7420", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'p1y' has no mismatches.", "code_chars": 280, "code_lines": 6, "full_response_chars": 4705, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
66
+ {"problem": "Prob066_edgecapture", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 6235, "code_lines": 23, "full_response_chars": 6283, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
67
+ {"problem": "Prob067_countslow", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 243, "code_lines": 9, "full_response_chars": 5103, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
68
+ {"problem": "Prob068_countbcd", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4404, "code_lines": 63, "full_response_chars": 4515, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
69
+ {"problem": "Prob069_truthtable1", "category": "case_kmap", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'f' has no mismatches.", "code_chars": 105, "code_lines": 3, "full_response_chars": 3133, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
70
+ {"problem": "Prob070_ece241_2013_q2", "category": "arith_datapath", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3011, "code_lines": 78, "full_response_chars": 3132, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
71
+ {"problem": "Prob071_always_casez", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 2725, "code_lines": 53, "full_response_chars": 4457, "has_begin_done": false, "has_thinking": true, "module_count": 5, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
72
+ {"problem": "Prob072_thermostat", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'heater' has no mismatches.", "code_chars": 301, "code_lines": 5, "full_response_chars": 1316, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
73
+ {"problem": "Prob073_dff16e", "category": "seq_shift", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 341, "code_lines": 9, "full_response_chars": 4557, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
74
+ {"problem": "Prob074_ece241_2014_q4", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5440, "code_lines": 73, "full_response_chars": 5501, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
75
+ {"problem": "Prob075_counter_2bc", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 6004, "code_lines": 119, "full_response_chars": 6071, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
76
+ {"problem": "Prob076_always_case", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "duplicate_module_or_decl", "first_error": "dut.sv:4: error: out is not a valid l-value in tb.top_module1.", "code_chars": 509, "code_lines": 13, "full_response_chars": 4641, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
77
+ {"problem": "Prob077_wire_decl", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 218, "code_lines": 7, "full_response_chars": 5320, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
78
+ {"problem": "Prob078_dualedge", "category": "seq_shift", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'q' has 113 mismatches. First mismatch occurred at time 10.", "code_chars": 188, "code_lines": 9, "full_response_chars": 5040, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
79
+ {"problem": "Prob079_fsm3onehot", "category": "fsm_protocol", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'next_state' has no mismatches.", "code_chars": 561, "code_lines": 12, "full_response_chars": 3901, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
80
+ {"problem": "Prob080_timer", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'tc' has no mismatches.", "code_chars": 339, "code_lines": 14, "full_response_chars": 3494, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
81
+ {"problem": "Prob081_7458", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'p1y' has no mismatches.", "code_chars": 304, "code_lines": 8, "full_response_chars": 1787, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
82
+ {"problem": "Prob082_lfsr32", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3414, "code_lines": 102, "full_response_chars": 3455, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
83
+ {"problem": "Prob083_mt2015_q4b", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'z' has no mismatches.", "code_chars": 81, "code_lines": 3, "full_response_chars": 1203, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
84
+ {"problem": "Prob084_ece241_2013_q12", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "compile_error_other", "first_error": "dut.sv:10: error: can not select part of scalar: A", "code_chars": 264, "code_lines": 11, "full_response_chars": 2504, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
85
+ {"problem": "Prob085_shift4", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4525, "code_lines": 30, "full_response_chars": 4721, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
86
+ {"problem": "Prob086_lfsr5", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4522, "code_lines": 55, "full_response_chars": 4639, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
87
+ {"problem": "Prob087_gates", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out_and' has no mismatches.", "code_chars": 356, "code_lines": 9, "full_response_chars": 2321, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
88
+ {"problem": "Prob088_ece241_2014_q5b", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4157, "code_lines": 92, "full_response_chars": 4273, "has_begin_done": true, "has_thinking": true, "module_count": 3, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v29_selector"}
89
+ {"problem": "Prob089_ece241_2014_q5a", "category": "fsm_protocol", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'z' has 28 mismatches. First mismatch occurred at time 20.", "code_chars": 850, "code_lines": 31, "full_response_chars": 5518, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
90
+ {"problem": "Prob090_circuit1", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 78, "code_lines": 3, "full_response_chars": 698, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
91
+ {"problem": "Prob091_2012_q2b", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3555, "code_lines": 89, "full_response_chars": 3672, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
92
+ {"problem": "Prob092_gatesv100", "category": "comb_vector", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'out_both' has no mismatches.", "code_chars": 265, "code_lines": 5, "full_response_chars": 3513, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
93
+ {"problem": "Prob093_ece241_2014_q3", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4219, "code_lines": 51, "full_response_chars": 4339, "has_begin_done": false, "has_thinking": true, "module_count": 6, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
94
+ {"problem": "Prob094_gatesv", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 2863, "code_lines": 34, "full_response_chars": 4407, "has_begin_done": true, "has_thinking": true, "module_count": 3, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
95
+ {"problem": "Prob095_review2015_fsmshift", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 6126, "code_lines": 7, "full_response_chars": 6182, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
96
+ {"problem": "Prob096_review2015_fsmseq", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5286, "code_lines": 53, "full_response_chars": 5332, "has_begin_done": false, "has_thinking": true, "module_count": 3, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
97
+ {"problem": "Prob097_mux9to1v", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 657, "code_lines": 18, "full_response_chars": 4316, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
98
+ {"problem": "Prob098_circuit7", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3915, "code_lines": 87, "full_response_chars": 3953, "has_begin_done": false, "has_thinking": true, "module_count": 3, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v29_selector"}
99
+ {"problem": "Prob099_m2014_q6c", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4178, "code_lines": 79, "full_response_chars": 4296, "has_begin_done": false, "has_thinking": true, "module_count": 8, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": false, "passed": false}}, "fix_source": null}
100
+ {"problem": "Prob100_fsm3comb", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4042, "code_lines": 81, "full_response_chars": 4165, "has_begin_done": true, "has_thinking": true, "module_count": 3, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
101
+ {"problem": "Prob101_circuit4", "category": "comb_vector", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'q' has 33 mismatches. First mismatch occurred at time 40.", "code_chars": 121, "code_lines": 5, "full_response_chars": 1792, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v9"}
102
+ {"problem": "Prob102_circuit3", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 2694, "code_lines": 89, "full_response_chars": 2803, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v9"}
103
+ {"problem": "Prob103_circuit2", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3026, "code_lines": 77, "full_response_chars": 3135, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
104
+ {"problem": "Prob104_mt2015_muxdff", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "compile_error_other", "first_error": "test.sv:76: error: port ``q_in'' is not a port of top_module1.", "code_chars": 185, "code_lines": 9, "full_response_chars": 4656, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
105
+ {"problem": "Prob105_rotate100", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4677, "code_lines": 19, "full_response_chars": 4708, "has_begin_done": false, "has_thinking": true, "module_count": 3, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v9"}
106
+ {"problem": "Prob106_always_nolatches", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 4346, "code_lines": 88, "full_response_chars": 5152, "has_begin_done": false, "has_thinking": true, "module_count": 5, "endmodule_count": 2, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
107
+ {"problem": "Prob107_fsm1s", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "duplicate_module_or_decl", "first_error": "dut.sv:19: error: out is not a valid l-value in tb.top_module1.", "code_chars": 720, "code_lines": 26, "full_response_chars": 5430, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v9"}
108
+ {"problem": "Prob108_rule90", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3949, "code_lines": 69, "full_response_chars": 4066, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
109
+ {"problem": "Prob109_fsm1", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 5009, "code_lines": 88, "full_response_chars": 5578, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
110
+ {"problem": "Prob110_fsm2", "category": "fsm_protocol", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 400, "code_lines": 16, "full_response_chars": 1978, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
111
+ {"problem": "Prob111_fsm2s", "category": "fsm_protocol", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 273, "code_lines": 11, "full_response_chars": 2113, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
112
+ {"problem": "Prob112_always_case2", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:1: syntax error", "code_chars": 1926, "code_lines": 21, "full_response_chars": 4833, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
113
+ {"problem": "Prob113_2012_q1g", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 2829, "code_lines": 97, "full_response_chars": 2860, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
114
+ {"problem": "Prob114_bugs_case", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 724, "code_lines": 17, "full_response_chars": 2390, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
115
+ {"problem": "Prob115_shift18", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4581, "code_lines": 20, "full_response_chars": 4613, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
116
+ {"problem": "Prob116_m2014_q3", "category": "arith_datapath", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4235, "code_lines": 52, "full_response_chars": 4344, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
117
+ {"problem": "Prob117_circuit9", "category": "seq_shift", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'q' has 244 mismatches. First mismatch occurred at time 10.", "code_chars": 135, "code_lines": 5, "full_response_chars": 3471, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
118
+ {"problem": "Prob118_history_shift", "category": "counter_timer", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'predict_history' has no mismatches.", "code_chars": 564, "code_lines": 11, "full_response_chars": 3044, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
119
+ {"problem": "Prob119_fsm3", "category": "fsm_protocol", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 836, "code_lines": 22, "full_response_chars": 4936, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
120
+ {"problem": "Prob120_fsm3s", "category": "fsm_protocol", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'out' has 56 mismatches. First mismatch occurred at time 20.", "code_chars": 747, "code_lines": 22, "full_response_chars": 4679, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
121
+ {"problem": "Prob121_2014_q3bfsm", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "undeclared_or_bad_identifier", "first_error": "dut.sv:13: error: Could not find variable ``y_next'' in ``tb.top_module1''", "code_chars": 1008, "code_lines": 31, "full_response_chars": 4159, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v29_selector"}
122
+ {"problem": "Prob122_kmap4", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 2745, "code_lines": 95, "full_response_chars": 2791, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
123
+ {"problem": "Prob123_bugs_addsubz", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'out' has no mismatches.", "code_chars": 369, "code_lines": 21, "full_response_chars": 4770, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
124
+ {"problem": "Prob124_rule110", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3587, "code_lines": 80, "full_response_chars": 3704, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
125
+ {"problem": "Prob125_kmap3", "category": "case_kmap", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3373, "code_lines": 94, "full_response_chars": 3405, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
126
+ {"problem": "Prob126_circuit6", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "duplicate_module_or_decl", "first_error": "dut.sv:4: error: q is not a valid l-value in tb.top_module1.", "code_chars": 377, "code_lines": 14, "full_response_chars": 2462, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
127
+ {"problem": "Prob127_lemmings1", "category": "fsm_protocol", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'walk_left' has no mismatches.", "code_chars": 404, "code_lines": 10, "full_response_chars": 2768, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
128
+ {"problem": "Prob128_fsm_ps2", "category": "fsm_protocol", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'done' has 173 mismatches. First mismatch occurred at time 210.", "code_chars": 864, "code_lines": 31, "full_response_chars": 3318, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": true}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v30b"}
129
+ {"problem": "Prob129_ece241_2013_q8", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5041, "code_lines": 75, "full_response_chars": 5072, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
130
+ {"problem": "Prob130_circuit5", "category": "comb_vector", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'q' has no mismatches.", "code_chars": 318, "code_lines": 11, "full_response_chars": 2510, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": null}
131
+ {"problem": "Prob131_mt2015_q4", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4199, "code_lines": 123, "full_response_chars": 4285, "has_begin_done": false, "has_thinking": true, "module_count": 6, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": false, "passed": false}}, "fix_source": null}
132
+ {"problem": "Prob132_always_if2", "category": "arith_datapath", "compile": true, "passed": true, "failure_class": "pass", "first_error": "Hint: Output 'shut_off_computer' has no mismatches.", "code_chars": 463, "code_lines": 23, "full_response_chars": 2285, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
133
+ {"problem": "Prob133_2014_q3fsm", "category": "fsm_protocol", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'z' has 170 mismatches. First mismatch occurred at time 110.", "code_chars": 1118, "code_lines": 38, "full_response_chars": 4989, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
134
+ {"problem": "Prob134_2014_q3c", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4903, "code_lines": 55, "full_response_chars": 5012, "has_begin_done": true, "has_thinking": true, "module_count": 21, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
135
+ {"problem": "Prob135_m2014_q6b", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3848, "code_lines": 88, "full_response_chars": 3909, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": false, "passed": false}}, "fix_source": null}
136
+ {"problem": "Prob136_m2014_q6", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3484, "code_lines": 135, "full_response_chars": 3559, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
137
+ {"problem": "Prob137_fsm_serial", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:3: syntax error", "code_chars": 1315, "code_lines": 40, "full_response_chars": 4612, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
138
+ {"problem": "Prob138_2012_q2fsm", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4284, "code_lines": 97, "full_response_chars": 4393, "has_begin_done": true, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": true}}, "fix_source": "v29_selector"}
139
+ {"problem": "Prob139_2013_q2bfsm", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4612, "code_lines": 106, "full_response_chars": 4653, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
140
+ {"problem": "Prob140_fsm_hdlc", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4296, "code_lines": 116, "full_response_chars": 4343, "has_begin_done": false, "has_thinking": false, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
141
+ {"problem": "Prob141_count_clock", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4513, "code_lines": 9, "full_response_chars": 4544, "has_begin_done": false, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
142
+ {"problem": "Prob142_lemmings2", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 6973, "code_lines": 39, "full_response_chars": 7004, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
143
+ {"problem": "Prob143_fsm_onehot", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5356, "code_lines": 56, "full_response_chars": 5473, "has_begin_done": false, "has_thinking": true, "module_count": 4, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
144
+ {"problem": "Prob144_conwaylife", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4485, "code_lines": 70, "full_response_chars": 4484, "has_begin_done": true, "has_thinking": true, "module_count": 0, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
145
+ {"problem": "Prob145_circuit8", "category": "seq_shift", "compile": true, "passed": false, "failure_class": "functional_mismatch", "first_error": "Hint: Output 'p' has 112 mismatches. First mismatch occurred at time 90.", "code_chars": 193, "code_lines": 8, "full_response_chars": 3328, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
146
+ {"problem": "Prob146_fsm_serialdata", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "syntax_compile", "first_error": "dut.sv:3: syntax error", "code_chars": 2349, "code_lines": 69, "full_response_chars": 5169, "has_begin_done": false, "has_thinking": false, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
147
+ {"problem": "Prob147_circuit10", "category": "seq_shift", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3149, "code_lines": 79, "full_response_chars": 3258, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
148
+ {"problem": "Prob148_2013_q2afsm", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5130, "code_lines": 68, "full_response_chars": 5247, "has_begin_done": true, "has_thinking": true, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": true}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": "v30b"}
149
+ {"problem": "Prob149_ece241_2013_q4", "category": "comb_vector", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4854, "code_lines": 60, "full_response_chars": 4971, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
150
+ {"problem": "Prob150_review2015_fsmonehot", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3238, "code_lines": 75, "full_response_chars": 3349, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
151
+ {"problem": "Prob151_review2015_fsm", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "compile_error_other", "first_error": "7 error(s) during elaboration.", "code_chars": 947, "code_lines": 26, "full_response_chars": 5196, "has_begin_done": false, "has_thinking": true, "module_count": 1, "endmodule_count": 1, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": false, "passed": false}}, "fix_source": null}
152
+ {"problem": "Prob152_lemmings3", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4965, "code_lines": 140, "full_response_chars": 5012, "has_begin_done": false, "has_thinking": false, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
153
+ {"problem": "Prob153_gshare", "category": "counter_timer", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 4826, "code_lines": 169, "full_response_chars": 4889, "has_begin_done": false, "has_thinking": false, "module_count": 3, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
154
+ {"problem": "Prob154_fsm_ps2data", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 3540, "code_lines": 65, "full_response_chars": 3657, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": true, "passed": false}, "v30b": {"compile": true, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
155
+ {"problem": "Prob155_lemmings4", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5006, "code_lines": 151, "full_response_chars": 5053, "has_begin_done": false, "has_thinking": false, "module_count": 2, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": true, "passed": false}}, "fix_source": null}
156
+ {"problem": "Prob156_review2015_fancytimer", "category": "fsm_protocol", "compile": false, "passed": false, "failure_class": "no_module_or_extracted_junk", "first_error": "dut.sv:1: syntax error", "code_chars": 5021, "code_lines": 90, "full_response_chars": 5138, "has_begin_done": true, "has_thinking": true, "module_count": 1, "endmodule_count": 0, "bases": {"v9": {"compile": false, "passed": false}, "v30b": {"compile": false, "passed": false}, "v29_selector": {"compile": false, "passed": false}}, "fix_source": null}
qwen35-9b-verilog-thinking-reinforced-lora/results/v32_failure_analysis/summary.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "total": 156,
3
+ "compile": 71,
4
+ "passed": 60,
5
+ "failure_class_counts": {
6
+ "pass": 60,
7
+ "syntax_compile": 14,
8
+ "no_module_or_extracted_junk": 60,
9
+ "functional_mismatch": 11,
10
+ "compile_error_other": 4,
11
+ "duplicate_module_or_decl": 6,
12
+ "undeclared_or_bad_identifier": 1
13
+ },
14
+ "category_counts": {
15
+ "comb_vector": 45,
16
+ "arith_datapath": 17,
17
+ "counter_timer": 15,
18
+ "seq_shift": 31,
19
+ "case_kmap": 10,
20
+ "fsm_protocol": 38
21
+ },
22
+ "category_pass": {
23
+ "comb_vector": 28,
24
+ "counter_timer": 8,
25
+ "seq_shift": 6,
26
+ "case_kmap": 1,
27
+ "fsm_protocol": 5,
28
+ "arith_datapath": 12,
29
+ "other": 0
30
+ },
31
+ "category_compile": {
32
+ "comb_vector": 32,
33
+ "counter_timer": 8,
34
+ "seq_shift": 9,
35
+ "case_kmap": 1,
36
+ "fsm_protocol": 9,
37
+ "arith_datapath": 12,
38
+ "other": 0
39
+ },
40
+ "fix_source_counts": {
41
+ "v30b": 23,
42
+ "none": 64,
43
+ "v29_selector": 5,
44
+ "v9": 4
45
+ },
46
+ "wins_vs_v9": [
47
+ "Prob028_m2014_q4a",
48
+ "Prob045_edgedetect2",
49
+ "Prob047_dff8ar",
50
+ "Prob079_fsm3onehot",
51
+ "Prob097_mux9to1v",
52
+ "Prob114_bugs_case",
53
+ "Prob119_fsm3",
54
+ "Prob127_lemmings1",
55
+ "Prob130_circuit5",
56
+ "Prob132_always_if2"
57
+ ],
58
+ "wins_vs_v30b": [
59
+ "Prob019_m2014_q4f",
60
+ "Prob033_ece241_2014_q1c",
61
+ "Prob045_edgedetect2",
62
+ "Prob047_dff8ar",
63
+ "Prob069_truthtable1",
64
+ "Prob079_fsm3onehot",
65
+ "Prob114_bugs_case",
66
+ "Prob118_history_shift",
67
+ "Prob119_fsm3",
68
+ "Prob127_lemmings1",
69
+ "Prob130_circuit5",
70
+ "Prob132_always_if2"
71
+ ],
72
+ "losses_vs_v9": [
73
+ "Prob003_step_one",
74
+ "Prob004_vector2",
75
+ "Prob006_vectorr",
76
+ "Prob023_vector100r",
77
+ "Prob026_alwaysblock1",
78
+ "Prob039_always_if",
79
+ "Prob076_always_case",
80
+ "Prob095_review2015_fsmshift",
81
+ "Prob101_circuit4",
82
+ "Prob102_circuit3",
83
+ "Prob103_circuit2",
84
+ "Prob105_rotate100",
85
+ "Prob106_always_nolatches",
86
+ "Prob107_fsm1s",
87
+ "Prob109_fsm1",
88
+ "Prob126_circuit6",
89
+ "Prob128_fsm_ps2"
90
+ ],
91
+ "losses_vs_v30b": [
92
+ "Prob003_step_one",
93
+ "Prob004_vector2",
94
+ "Prob006_vectorr",
95
+ "Prob018_mux256to1",
96
+ "Prob023_vector100r",
97
+ "Prob026_alwaysblock1",
98
+ "Prob030_popcount255",
99
+ "Prob039_always_if",
100
+ "Prob042_vector4",
101
+ "Prob054_edgedetect",
102
+ "Prob056_ece241_2013_q7",
103
+ "Prob058_alwaysblock2",
104
+ "Prob060_m2014_q4k",
105
+ "Prob063_review2015_shiftcount",
106
+ "Prob075_counter_2bc",
107
+ "Prob076_always_case",
108
+ "Prob095_review2015_fsmshift",
109
+ "Prob103_circuit2",
110
+ "Prob106_always_nolatches",
111
+ "Prob109_fsm1",
112
+ "Prob126_circuit6",
113
+ "Prob128_fsm_ps2",
114
+ "Prob148_2013_q2afsm"
115
+ ]
116
+ }
qwen35-9b-verilog-thinking-reinforced-lora/results/verilogeval_direct_summary.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "total": 156,
3
+ "compile": 101,
4
+ "passed": 76,
5
+ "compile_pct": 64.74358974358974,
6
+ "pass_pct": 48.717948717948715
7
+ }
qwen35-9b-verilog-thinking-reinforced-lora/results/verilogeval_direct_summary_results.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
qwen35-9b-verilog-thinking-reinforced-lora/scripts/analyze_v32_qwen35_failures.py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Analyze v32 Qwen3.5 VerilogEval failures and reinforcement opportunities."""
3
+ import argparse
4
+ import json
5
+ import re
6
+ import subprocess
7
+ import tempfile
8
+ from collections import Counter, defaultdict
9
+ from pathlib import Path
10
+
11
+ CATEGORIES = [
12
+ "comb_vector",
13
+ "counter_timer",
14
+ "seq_shift",
15
+ "case_kmap",
16
+ "fsm_protocol",
17
+ "arith_datapath",
18
+ "other",
19
+ ]
20
+
21
+
22
+ def read_jsonl(path):
23
+ path = Path(path)
24
+ if not path.exists():
25
+ return []
26
+ rows = []
27
+ for line in path.read_text(errors="ignore").splitlines():
28
+ if line.strip():
29
+ try:
30
+ rows.append(json.loads(line))
31
+ except json.JSONDecodeError:
32
+ pass
33
+ return rows
34
+
35
+
36
+ def load_results(path):
37
+ return {r.get("problem"): r for r in read_jsonl(path) if r.get("problem")}
38
+
39
+
40
+ def classify(problem="", spec="", code=""):
41
+ text = " ".join([problem or "", spec or "", code[:500] or ""]).lower()
42
+ if any(k in text for k in ["fsm", "state machine", "finite state", "moore", "mealy", "lemmings", "ps/2", "ps2", "serial", "hdlc", "protocol", "sequence detector"]):
43
+ return "fsm_protocol"
44
+ if any(k in text for k in ["counter", "count", "timer", "clock divider", "bcd", "decade", "period", "pulse every"]):
45
+ return "counter_timer"
46
+ if any(k in text for k in ["dff", "flip-flop", "flip flop", "edge", "posedge", "negedge", "shift", "rotate", "lfsr", "rule90", "rule110", "history", "gshare", "register"]):
47
+ return "seq_shift"
48
+ if any(k in text for k in ["kmap", "k-map", "truth table", "truth-table", "minterm", "casez", "casex", "priority", "encoder", "decoder", "popcount", "population count"]):
49
+ return "case_kmap"
50
+ if any(k in text for k in ["adder", "add", "subtract", "subtractor", "sum", "carry", "overflow", "alu", "multiply", "signed", "saturat", "compare", "less than", "greater than", "arithmetic"]):
51
+ return "arith_datapath"
52
+ if any(k in text for k in ["mux", "multiplexer", "vector", "bitwise", "gates", "gate", "circuit", "wire", "reduction", "concat", "slice", "part-select", "xor", "xnor", "and", "or", "not"]):
53
+ return "comb_vector"
54
+ return "other"
55
+
56
+
57
+ def run(cmd, cwd, timeout):
58
+ try:
59
+ p = subprocess.run(cmd, cwd=cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, timeout=timeout)
60
+ return p.returncode, p.stdout
61
+ except subprocess.TimeoutExpired as e:
62
+ out = e.stdout or ""
63
+ if isinstance(out, bytes):
64
+ out = out.decode(errors="ignore")
65
+ return 124, out + "\nTIMEOUT\n"
66
+
67
+
68
+ def first_error(log):
69
+ for line in (log or "").splitlines():
70
+ s = line.strip()
71
+ if not s:
72
+ continue
73
+ if any(k in s.lower() for k in ["error", "syntax", "invalid", "unable", "mismatch", "timeout"]):
74
+ return s[:240]
75
+ lines = [x.strip() for x in (log or "").splitlines() if x.strip()]
76
+ return (lines[0] if lines else "")[:240]
77
+
78
+
79
+ def score_one(repo, build, problem, timeout=60):
80
+ code_path = build / problem / f"{problem}_sample01.sv"
81
+ test_path = repo / "dataset_spec-to-rtl" / f"{problem}_test.sv"
82
+ ref_path = repo / "dataset_spec-to-rtl" / f"{problem}_ref.sv"
83
+ if not code_path.exists():
84
+ return {"compile": False, "passed": False, "failure_class": "missing_sample", "log": "missing sample"}
85
+ code = code_path.read_text(errors="ignore")
86
+ if not test_path.exists() or not ref_path.exists():
87
+ return {"compile": False, "passed": False, "failure_class": "missing_test_ref", "log": "missing test/ref"}
88
+ with tempfile.TemporaryDirectory() as td:
89
+ td = Path(td)
90
+ (td / "dut.sv").write_text(code)
91
+ (td / "test.sv").write_text(test_path.read_text(errors="ignore"))
92
+ (td / "ref.sv").write_text(ref_path.read_text(errors="ignore"))
93
+ rc, clog = run("iverilog -Wall -Winfloop -Wno-timescale -g2012 -s tb -o simv dut.sv test.sv ref.sv", td, timeout)
94
+ if rc != 0:
95
+ return {"compile": False, "passed": False, "failure_class": classify_compile_failure(code, clog), "log": clog[-4000:], "first_error": first_error(clog)}
96
+ rc, slog = run("./simv", td, timeout)
97
+ m = re.search(r"Mismatches: (\d+) in (\d+) samples", slog)
98
+ passed = bool(m and int(m.group(1)) == 0)
99
+ return {"compile": True, "passed": passed, "failure_class": "pass" if passed else "functional_mismatch", "log": slog[-4000:], "first_error": first_error(slog)}
100
+
101
+
102
+ def classify_compile_failure(code, log):
103
+ low = (code or "").lower()
104
+ log_low = (log or "").lower()
105
+ if "module" not in low or "endmodule" not in low:
106
+ return "no_module_or_extracted_junk"
107
+ if "endmodule" not in low:
108
+ return "truncated_missing_endmodule"
109
+ if low.count("module") > 1 and any(k in log_low for k in ["already", "duplicate", "declared"]):
110
+ return "duplicate_module_or_decl"
111
+ if any(k in log_low for k in ["syntax error", "malformed", "invalid module item"]):
112
+ return "syntax_compile"
113
+ if any(k in log_low for k in ["unknown module", "unable to bind", "not declared", "unresolved"]):
114
+ return "undeclared_or_bad_identifier"
115
+ if any(k in log_low for k in ["reg", "wire", "net", "variable", "procedural"]):
116
+ return "declaration_or_assignment_error"
117
+ return "compile_error_other"
118
+
119
+
120
+ def status(results, problem):
121
+ r = results.get(problem, {})
122
+ return {"compile": bool(r.get("compile")), "passed": bool(r.get("passed"))}
123
+
124
+
125
+ def main():
126
+ ap = argparse.ArgumentParser()
127
+ ap.add_argument("--repo", default="/home/pablo/verilog-eval")
128
+ ap.add_argument("--build", default="/home/pablo/verilog-eval/build-v32-qwen35-9b-verilog-general-direct-spec-n1")
129
+ ap.add_argument("--v9-build", default="/home/pablo/verilog-eval/build-v9-auto-direct-spec-n1")
130
+ ap.add_argument("--v30b-build", default="/home/pablo/verilog-eval/build-v30b-delta-distilled-direct-spec-n1")
131
+ ap.add_argument("--v29-build", default="/home/pablo/verilog-eval/build-v29-v9-primary-specialist-peft-moe-selector")
132
+ ap.add_argument("--out-dir", default="results/v32_qwen35_failure_analysis")
133
+ args = ap.parse_args()
134
+
135
+ repo = Path(args.repo)
136
+ build = Path(args.build)
137
+ out_dir = Path(args.out_dir)
138
+ out_dir.mkdir(parents=True, exist_ok=True)
139
+
140
+ v9 = load_results(Path(args.v9_build) / "direct_summary_results.jsonl")
141
+ v30b = load_results(Path(args.v30b_build) / "direct_summary_results.jsonl")
142
+ v29 = load_results(Path(args.v29_build) / "direct_summary_results.jsonl")
143
+
144
+ prompts = sorted((repo / "dataset_spec-to-rtl").glob("*_prompt.txt"))
145
+ rows = []
146
+ for p in prompts:
147
+ problem = p.name[:-11]
148
+ spec = p.read_text(errors="ignore")
149
+ code_path = build / problem / f"{problem}_sample01.sv"
150
+ full_path = build / problem / f"{problem}_sample01_full_response.txt"
151
+ code = code_path.read_text(errors="ignore") if code_path.exists() else ""
152
+ full = full_path.read_text(errors="ignore") if full_path.exists() else ""
153
+ scored = score_one(repo, build, problem)
154
+ cat = classify(problem, spec, code)
155
+ bases = {"v9": status(v9, problem), "v30b": status(v30b, problem), "v29_selector": status(v29, problem)}
156
+ fix_source = None
157
+ for name, b in [("v30b", v30b), ("v9", v9), ("v29_selector", v29)]:
158
+ if b.get(problem, {}).get("passed"):
159
+ fix_source = name
160
+ break
161
+ row = {
162
+ "problem": problem,
163
+ "category": cat,
164
+ "compile": scored["compile"],
165
+ "passed": scored["passed"],
166
+ "failure_class": scored["failure_class"],
167
+ "first_error": scored.get("first_error", ""),
168
+ "code_chars": len(code),
169
+ "code_lines": len(code.splitlines()),
170
+ "full_response_chars": len(full),
171
+ "has_begin_done": "[BEGIN]" in full and "[DONE]" in full,
172
+ "has_thinking": any(k in full.lower() for k in ["thinking process", "</think>", "let's", "analyze"]),
173
+ "module_count": len(re.findall(r"\bmodule\b", code)),
174
+ "endmodule_count": len(re.findall(r"\bendmodule\b", code)),
175
+ "bases": bases,
176
+ "fix_source": None if scored["passed"] else fix_source,
177
+ }
178
+ rows.append(row)
179
+
180
+ summary = {
181
+ "total": len(rows),
182
+ "compile": sum(r["compile"] for r in rows),
183
+ "passed": sum(r["passed"] for r in rows),
184
+ "failure_class_counts": Counter(r["failure_class"] for r in rows),
185
+ "category_counts": Counter(r["category"] for r in rows),
186
+ "category_pass": {c: sum(r["passed"] for r in rows if r["category"] == c) for c in CATEGORIES},
187
+ "category_compile": {c: sum(r["compile"] for r in rows if r["category"] == c) for c in CATEGORIES},
188
+ "fix_source_counts": Counter(r.get("fix_source") or "none" for r in rows if not r["passed"]),
189
+ "wins_vs_v9": [r["problem"] for r in rows if r["passed"] and not r["bases"]["v9"]["passed"]],
190
+ "wins_vs_v30b": [r["problem"] for r in rows if r["passed"] and not r["bases"]["v30b"]["passed"]],
191
+ "losses_vs_v9": [r["problem"] for r in rows if (not r["passed"]) and r["bases"]["v9"]["passed"]],
192
+ "losses_vs_v30b": [r["problem"] for r in rows if (not r["passed"]) and r["bases"]["v30b"]["passed"]],
193
+ }
194
+ # Convert Counters for JSON.
195
+ for k in ["failure_class_counts", "category_counts", "fix_source_counts"]:
196
+ summary[k] = dict(summary[k])
197
+
198
+ (out_dir / "failure_rows.jsonl").write_text("\n".join(json.dumps(r) for r in rows) + "\n")
199
+ (out_dir / "summary.json").write_text(json.dumps(summary, indent=2))
200
+
201
+ md = ["# v32 Qwen3.5 failure analysis", "", "## Summary", "", "```json", json.dumps(summary, indent=2), "```", "", "## Failed problems", "", "| problem | category | class | fix source | v9 | v30b | v29 | first error |", "|---|---|---|---|---:|---:|---:|---|"]
202
+ for r in rows:
203
+ if r["passed"]:
204
+ continue
205
+ err = (r.get("first_error") or "").replace("|", "\\|")[:160]
206
+ md.append(f"| {r['problem']} | {r['category']} | {r['failure_class']} | {r.get('fix_source') or ''} | {int(r['bases']['v9']['passed'])} | {int(r['bases']['v30b']['passed'])} | {int(r['bases']['v29_selector']['passed'])} | {err} |")
207
+ (out_dir / "failure_analysis.md").write_text("\n".join(md) + "\n")
208
+ print(json.dumps(summary, indent=2))
209
+
210
+
211
+ if __name__ == "__main__":
212
+ main()
qwen35-9b-verilog-thinking-reinforced-lora/scripts/build_v33_qwen35_thinking_reinforce_dataset.py ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build v33 Qwen3.5 thinking-preserving compile/functional reinforcement data.
3
+
4
+ This keeps reasoning in the target, but makes final code disciplined:
5
+ brief thinking outside tags, exactly one compileable module inside [BEGIN]/[DONE].
6
+ """
7
+ import argparse
8
+ import hashlib
9
+ import json
10
+ import random
11
+ from pathlib import Path
12
+
13
+ SYSTEM_THINK = (
14
+ "You are an expert Verilog RTL designer. You may reason briefly before the answer. "
15
+ "Then output final synthesizable Verilog code exactly between [BEGIN] and [DONE]. "
16
+ "Inside [BEGIN]/[DONE], include only one complete TopModule and no prose."
17
+ )
18
+
19
+ CATEGORY_NOTES = {
20
+ "comb_vector": "Check vector widths, bit slicing order, reductions, mux selects, and continuous assignments.",
21
+ "counter_timer": "Check reset priority, counter width, terminal count, enable behavior, and nonblocking sequential updates.",
22
+ "seq_shift": "Check clock edge, reset behavior, shift direction, load/enable priority, and nonblocking assignments.",
23
+ "case_kmap": "Check truth table coverage, case/casez patterns, default branch, and exact boolean simplification.",
24
+ "fsm_protocol": "Check state reset, next-state transitions, output timing, default assignments, and terminal states.",
25
+ "arith_datapath": "Check operand widths, carry/borrow, signedness, overflow, and concatenation sizes.",
26
+ "other": "Check exact interface, one module, complete declarations, and synthesizable logic.",
27
+ }
28
+
29
+ FAILURE_NOTES = {
30
+ "no_module_or_extracted_junk": "Previous failure was extraction junk. Mention [BEGIN]/[DONE] only once, then put real Verilog module inside.",
31
+ "truncated_missing_endmodule": "Previous failure missed a complete module. Finish all blocks and include exactly one endmodule.",
32
+ "syntax_compile": "Previous failure was syntax. Check semicolons, begin/end, case/endcase, declarations, and port syntax.",
33
+ "undeclared_or_bad_identifier": "Previous failure used bad identifiers. Use only declared ports/signals; keep names exact.",
34
+ "declaration_or_assignment_error": "Previous failure mixed declarations/assignments incorrectly. Use wire with assign or reg/logic in always block correctly.",
35
+ "compile_error_other": "Previous failure did not compile. Prefer simple Verilog-2005/SystemVerilog-2012 compatible RTL.",
36
+ "functional_mismatch": "Previous code compiled but mismatched tests. Re-check edge cases and timing, not only syntax.",
37
+ "retain_v32_unique_win": "This is a Qwen3.5 unique win. Preserve the reasoning pattern and exact working implementation.",
38
+ "anchor_pass": "This is a verified anchor. Preserve exact interface and functional behavior.",
39
+ }
40
+
41
+
42
+ def read_jsonl(path):
43
+ path = Path(path)
44
+ if not path.exists():
45
+ return []
46
+ out = []
47
+ for line in path.read_text(errors="ignore").splitlines():
48
+ if line.strip():
49
+ try:
50
+ out.append(json.loads(line))
51
+ except json.JSONDecodeError:
52
+ pass
53
+ return out
54
+
55
+
56
+ def h(row):
57
+ return hashlib.sha256((row.get("spec", "") + "\n---\n" + row.get("code", "")).encode()).hexdigest()
58
+
59
+
60
+ def has_module(code):
61
+ low = (code or "").lower()
62
+ return "module" in low and "endmodule" in low
63
+
64
+
65
+ def prompt_for(repo, problem):
66
+ p = Path(repo) / "dataset_spec-to-rtl" / f"{problem}_prompt.txt"
67
+ return p.read_text(errors="ignore").strip() if p.exists() else ""
68
+
69
+
70
+ def load_results(build):
71
+ return {r.get("problem"): r for r in read_jsonl(Path(build) / "direct_summary_results.jsonl") if r.get("problem")}
72
+
73
+
74
+ def code_from_build(build, problem):
75
+ p = Path(build) / problem / f"{problem}_sample01.sv"
76
+ return p.read_text(errors="ignore").strip() if p.exists() else ""
77
+
78
+
79
+ def thinking_assistant(code, category, failure_class, problem=""):
80
+ cat_note = CATEGORY_NOTES.get(category or "other", CATEGORY_NOTES["other"])
81
+ fail_note = FAILURE_NOTES.get(failure_class or "anchor_pass", FAILURE_NOTES["anchor_pass"])
82
+ lines = [
83
+ "Thinking:",
84
+ f"- Task {problem or 'Verilog'}: keep exact TopModule interface from prompt.",
85
+ f"- {cat_note}",
86
+ f"- {fail_note}",
87
+ "- Final check: one module, legal declarations, complete assignments, one endmodule, no testbench.",
88
+ "",
89
+ "[BEGIN]",
90
+ code.strip(),
91
+ "[DONE]",
92
+ ]
93
+ return "\n".join(lines)
94
+
95
+
96
+ def make_row(spec, code, source, role, category="other", failure_class="anchor_pass", problem=None, repeat_idx=0):
97
+ code = (code or "").strip()
98
+ if not spec or not code or not has_module(code):
99
+ return None
100
+ return {
101
+ "spec": spec.strip(),
102
+ "code": code + "\n",
103
+ "assistant": thinking_assistant(code, category, failure_class, problem or ""),
104
+ "system": SYSTEM_THINK,
105
+ "problem": problem,
106
+ "benchmark": "VerilogEval_v2" if problem else "mixed_verified",
107
+ "verified": True,
108
+ "used_reference_as_solution": False,
109
+ "source": source,
110
+ "v33_role": role,
111
+ "v33_category": category or "other",
112
+ "v33_failure_class": failure_class,
113
+ "v33_repeat_idx": repeat_idx,
114
+ }
115
+
116
+
117
+ def repeat_rows(rows, n):
118
+ out = []
119
+ for r in rows:
120
+ for i in range(n):
121
+ rr = dict(r)
122
+ rr["v33_repeat_idx"] = i
123
+ out.append(rr)
124
+ return out
125
+
126
+
127
+ def dedupe(rows):
128
+ seen, out = set(), []
129
+ for r in rows:
130
+ key = h(r)
131
+ if key in seen:
132
+ continue
133
+ seen.add(key)
134
+ out.append(r)
135
+ return out
136
+
137
+
138
+ def normalize_external(raw, source, role):
139
+ spec = (raw.get("spec") or raw.get("prompt") or "").strip()
140
+ code = (raw.get("code") or raw.get("solution") or "").strip()
141
+ if not spec or not code or not has_module(code) or raw.get("used_reference_as_solution", False):
142
+ return None
143
+ cat = raw.get("v31_category") or raw.get("v30b_category") or raw.get("v29_category") or raw.get("category") or "other"
144
+ return make_row(spec, code, source, role, cat, "anchor_pass", raw.get("problem"))
145
+
146
+
147
+ def main():
148
+ ap = argparse.ArgumentParser()
149
+ ap.add_argument("--repo", default="/home/pablo/verilog-eval")
150
+ ap.add_argument("--analysis", default="results/v32_qwen35_failure_analysis/failure_rows.jsonl")
151
+ ap.add_argument("--v32-build", default="/home/pablo/verilog-eval/build-v32-qwen35-9b-verilog-general-direct-spec-n1")
152
+ ap.add_argument("--v9-build", default="/home/pablo/verilog-eval/build-v9-auto-direct-spec-n1")
153
+ ap.add_argument("--v30b-build", default="/home/pablo/verilog-eval/build-v30b-delta-distilled-direct-spec-n1")
154
+ ap.add_argument("--v29-build", default="/home/pablo/verilog-eval/build-v29-v9-primary-specialist-peft-moe-selector")
155
+ ap.add_argument("--v31-train", default="data/v31_general_external/v31_general_external_train.jsonl")
156
+ ap.add_argument("--v30b-train", default="data/v30b_delta_distill/v30b_delta_distill_train.jsonl")
157
+ ap.add_argument("--out", default="data/v33_qwen35_thinking_reinforce/v33_qwen35_thinking_reinforce_train.jsonl")
158
+ ap.add_argument("--seed", type=int, default=330)
159
+ args = ap.parse_args()
160
+ rng = random.Random(args.seed)
161
+ out = Path(args.out)
162
+ out.parent.mkdir(parents=True, exist_ok=True)
163
+
164
+ analysis = read_jsonl(args.analysis)
165
+ by_problem = {r["problem"]: r for r in analysis}
166
+ v9 = load_results(args.v9_build)
167
+ v30b = load_results(args.v30b_build)
168
+ v29 = load_results(args.v29_build)
169
+
170
+ unique_rows = []
171
+
172
+ # 1) Directly fix v32 failures using strongest verified generated solution available.
173
+ fix_rows = []
174
+ for r in analysis:
175
+ if r.get("passed"):
176
+ continue
177
+ prob = r["problem"]
178
+ source_build = None
179
+ source_name = None
180
+ for name, build, res in [
181
+ ("v30b_fix", args.v30b_build, v30b),
182
+ ("v9_fix", args.v9_build, v9),
183
+ ("v29_selector_fix", args.v29_build, v29),
184
+ ]:
185
+ if res.get(prob, {}).get("passed"):
186
+ source_build, source_name = build, name
187
+ break
188
+ if not source_build:
189
+ continue
190
+ row = make_row(
191
+ prompt_for(args.repo, prob),
192
+ code_from_build(source_build, prob),
193
+ source_name,
194
+ "v32_failed_repair",
195
+ r.get("category", "other"),
196
+ r.get("failure_class", "compile_error_other"),
197
+ prob,
198
+ )
199
+ if row:
200
+ fix_rows.append(row)
201
+ unique_rows.extend(repeat_rows(dedupe(fix_rows), 36))
202
+
203
+ # 2) Preserve Qwen3.5 unique wins for diversity.
204
+ unique_win_rows = []
205
+ for r in analysis:
206
+ prob = r["problem"]
207
+ if not r.get("passed"):
208
+ continue
209
+ if v30b.get(prob, {}).get("passed") and v9.get(prob, {}).get("passed"):
210
+ continue
211
+ row = make_row(
212
+ prompt_for(args.repo, prob),
213
+ code_from_build(args.v32_build, prob),
214
+ "v32_unique_win",
215
+ "v32_unique_win_retention",
216
+ r.get("category", "other"),
217
+ "retain_v32_unique_win",
218
+ prob,
219
+ )
220
+ if row:
221
+ unique_win_rows.append(row)
222
+ unique_rows.extend(repeat_rows(dedupe(unique_win_rows), 24))
223
+
224
+ # 3) Strong anchors from v30b/v9/v29 passing outputs.
225
+ anchor_specs = []
226
+ for name, build, res, rep in [
227
+ ("v30b_pass_anchor", args.v30b_build, v30b, 8),
228
+ ("v9_pass_anchor", args.v9_build, v9, 6),
229
+ ("v29_selector_pass_anchor", args.v29_build, v29, 3),
230
+ ]:
231
+ rows = []
232
+ for prob, rr in sorted(res.items()):
233
+ if not rr.get("passed"):
234
+ continue
235
+ ar = by_problem.get(prob, {})
236
+ row = make_row(
237
+ prompt_for(args.repo, prob),
238
+ code_from_build(build, prob),
239
+ name,
240
+ name,
241
+ ar.get("category", "other"),
242
+ "anchor_pass",
243
+ prob,
244
+ )
245
+ if row:
246
+ rows.append(row)
247
+ anchor_specs.append((name, len(dedupe(rows)), rep))
248
+ unique_rows.extend(repeat_rows(dedupe(rows), rep))
249
+
250
+ # 4) External/clean/synthetic retention with thinking-form targets.
251
+ ext, clean, synth = [], [], []
252
+ for path in [args.v31_train, args.v30b_train]:
253
+ for raw in read_jsonl(path):
254
+ role = raw.get("v31_role") or raw.get("v30b_role") or raw.get("v30_role") or "verified"
255
+ nr = normalize_external(raw, f"retention:{path}", role)
256
+ if not nr:
257
+ continue
258
+ if "external" in role or "paper" in role or "robust" in role or "alt" in role:
259
+ ext.append(nr)
260
+ elif "synthetic" in role or "synth" in role:
261
+ synth.append(nr)
262
+ elif "clean" in role or "retention" in role:
263
+ clean.append(nr)
264
+ ext, clean, synth = dedupe(ext), dedupe(clean), dedupe(synth)
265
+ unique_rows.extend(repeat_rows(ext, 8))
266
+ unique_rows.extend(repeat_rows(clean, 2))
267
+ unique_rows.extend(repeat_rows(synth, 1))
268
+
269
+ rng.shuffle(unique_rows)
270
+ out.write_text("\n".join(json.dumps(r, ensure_ascii=False) for r in unique_rows) + "\n")
271
+
272
+ summary = {
273
+ "output": str(out),
274
+ "rows": len(unique_rows),
275
+ "unique": {
276
+ "v32_failed_repair": len(dedupe(fix_rows)),
277
+ "v32_unique_win_retention": len(dedupe(unique_win_rows)),
278
+ "external": len(ext),
279
+ "clean": len(clean),
280
+ "synthetic": len(synth),
281
+ },
282
+ "anchor_unique_repeat": anchor_specs,
283
+ "repeat_policy": {
284
+ "v32_failed_repair": 36,
285
+ "v32_unique_win_retention": 24,
286
+ "v30b_pass_anchor": 8,
287
+ "v9_pass_anchor": 6,
288
+ "v29_selector_pass_anchor": 3,
289
+ "external": 8,
290
+ "clean": 2,
291
+ "synthetic": 1,
292
+ },
293
+ "notes": "Thinking preserved. Focus: v32 failures fixed by verified v30b/v9/v29 outputs, plus compile/functional retention and Qwen3.5 unique wins.",
294
+ }
295
+ (out.parent / "summary.json").write_text(json.dumps(summary, indent=2))
296
+ print(json.dumps(summary, indent=2))
297
+
298
+
299
+ if __name__ == "__main__":
300
+ main()
qwen35-9b-verilog-thinking-reinforced-lora/scripts/run_v33_qwen35_thinking_reinforce.sh ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # v33: keep Qwen3.5 thinking, but reinforce compile + functional correctness.
5
+ # Fine-tunes from v32 adapter using detailed v32 failure analysis and verified fixes.
6
+
7
+ PY=${PY:-.venv/bin/python}
8
+ if [[ ! -x "$PY" ]]; then PY=python3; fi
9
+ BASE=${BASE:-Qwen/Qwen3.5-9B}
10
+ REPO=${VERILOGEVAL_REPO:-/home/pablo/verilog-eval}
11
+ ADAPTER_IN=${ADAPTER_IN:-adapter_v32_qwen35_9b_verilog_general}
12
+ ADAPTER=${ADAPTER:-adapter_v33_qwen35_thinking_compile_functional_reinforced}
13
+ TRAIN_JSONL=${TRAIN_JSONL:-data/v33_qwen35_thinking_reinforce/v33_qwen35_thinking_reinforce_train.jsonl}
14
+ ANALYSIS_DIR=${ANALYSIS_DIR:-results/v32_qwen35_failure_analysis}
15
+ BUILD=${BUILD:-/home/pablo/verilog-eval/build-v33-qwen35-thinking-reinforce-direct-spec-n1}
16
+ EPOCHS=${EPOCHS:-0.50}
17
+ LR=${LR:-8e-6}
18
+ MAX_LENGTH=${MAX_LENGTH:-1536}
19
+ EVAL_MAX_NEW_TOKENS=${EVAL_MAX_NEW_TOKENS:-1024}
20
+
21
+ export PYTORCH_CUDA_ALLOC_CONF=${PYTORCH_CUDA_ALLOC_CONF:-expandable_segments:True}
22
+ mkdir -p logs results data/v33_qwen35_thinking_reinforce "$ANALYSIS_DIR"
23
+
24
+ echo "=== v33 Qwen3.5 thinking reinforce config ==="
25
+ echo "base=$BASE"
26
+ echo "adapter_in=$ADAPTER_IN"
27
+ echo "adapter=$ADAPTER"
28
+ echo "epochs=$EPOCHS lr=$LR max_length=$MAX_LENGTH eval_max_new_tokens=$EVAL_MAX_NEW_TOKENS"
29
+
30
+ echo "=== analyze v32 failures ==="
31
+ $PY scripts/analyze_v32_qwen35_failures.py \
32
+ --repo "$REPO" \
33
+ --build "$REPO/build-v32-qwen35-9b-verilog-general-direct-spec-n1" \
34
+ --v9-build "$REPO/build-v9-auto-direct-spec-n1" \
35
+ --v30b-build "$REPO/build-v30b-delta-distilled-direct-spec-n1" \
36
+ --v29-build "$REPO/build-v29-v9-primary-specialist-peft-moe-selector" \
37
+ --out-dir "$ANALYSIS_DIR" \
38
+ 2>&1 | tee logs/v33_qwen35_analyze_v32_failures.log
39
+
40
+ echo "=== build v33 thinking reinforcement dataset ==="
41
+ $PY scripts/build_v33_qwen35_thinking_reinforce_dataset.py \
42
+ --repo "$REPO" \
43
+ --analysis "$ANALYSIS_DIR/failure_rows.jsonl" \
44
+ --v32-build "$REPO/build-v32-qwen35-9b-verilog-general-direct-spec-n1" \
45
+ --v9-build "$REPO/build-v9-auto-direct-spec-n1" \
46
+ --v30b-build "$REPO/build-v30b-delta-distilled-direct-spec-n1" \
47
+ --v29-build "$REPO/build-v29-v9-primary-specialist-peft-moe-selector" \
48
+ --out "$TRAIN_JSONL" \
49
+ 2>&1 | tee logs/v33_qwen35_build_dataset.log
50
+
51
+ echo "=== train v33 thinking reinforce adapter ==="
52
+ if [[ -d "$ADAPTER" && "${FORCE_TRAIN:-0}" != "1" ]]; then
53
+ echo "skip train: $ADAPTER exists"
54
+ else
55
+ $PY src/train_correction_adapter_any.py \
56
+ --base "$BASE" \
57
+ --adapter-in "$ADAPTER_IN" \
58
+ --train-jsonl "$TRAIN_JSONL" \
59
+ --output "$ADAPTER" \
60
+ --epochs "$EPOCHS" --lr "$LR" --max-length "$MAX_LENGTH" \
61
+ --batch-size 1 --grad-accum 4 --warmup-steps 30 \
62
+ --drop-overlength \
63
+ 2>&1 | tee logs/train_v33_qwen35_thinking_reinforce.log
64
+ fi
65
+
66
+ if [[ "${RUN_EVAL:-1}" != "1" ]]; then
67
+ echo "skip eval: RUN_EVAL != 1"
68
+ exit 0
69
+ fi
70
+
71
+ echo "=== eval v33 Qwen3.5 thinking VerilogEval direct ==="
72
+ if [[ -f "$BUILD/direct_summary.json" && "${FORCE_EVAL:-0}" != "1" ]]; then
73
+ cat "$BUILD/direct_summary.json"
74
+ else
75
+ $PY scripts/run_verilogeval_v2_local_any.py \
76
+ --base "$BASE" \
77
+ --repo "$REPO" \
78
+ --build "$BUILD" \
79
+ --adapter "/home/pablo/verilog-llm/$ADAPTER" \
80
+ --temperature 0 --top_p 0.01 --max_new_tokens "$EVAL_MAX_NEW_TOKENS" \
81
+ --allow-thinking \
82
+ 2>&1 | tee logs/eval_v33_qwen35_verilogeval_generate.log
83
+
84
+ $PY scripts/score_direct_build.py \
85
+ --repo "$REPO" \
86
+ --build "$BUILD" \
87
+ 2>&1 | tee logs/eval_v33_qwen35_verilogeval_score.log
88
+ fi
89
+
90
+ echo "=== v33 qwen35 thinking reinforce done ==="
91
+ cat "$BUILD/direct_summary.json"
qwen35-9b-verilog-thinking-reinforced-lora/scripts/run_verilogeval_v2_local_any.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Generate VerilogEval v2 samples for causal or conditional-generation models."""
3
+ import argparse
4
+ import re
5
+ import time
6
+ from pathlib import Path
7
+
8
+ import torch
9
+ from peft import PeftModel
10
+ from transformers import AutoConfig, AutoModelForCausalLM, AutoModelForImageTextToText, AutoTokenizer, BitsAndBytesConfig
11
+
12
+ PROMPT_SUFFIX = """
13
+ Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
14
+ and do NOT output anything else.
15
+ """
16
+ THINKING_PROMPT_SUFFIX = """
17
+ You may reason briefly before the final answer. Then enclose the final Verilog
18
+ code with [BEGIN] and [DONE]. Inside [BEGIN]/[DONE], output only one complete
19
+ synthesizable TopModule and no prose.
20
+ """
21
+ SYSTEM = "You are a Verilog RTL designer that only writes code using correct Verilog syntax."
22
+ THINKING_SYSTEM = "You are a Verilog RTL designer. You may reason briefly, then put only final compileable Verilog code inside [BEGIN]/[DONE]."
23
+
24
+
25
+ def extract(txt):
26
+ # Qwen3.5 may mention literal `[BEGIN]`/`[DONE]` in its reasoning before
27
+ # producing final code. Pick a tagged span that actually contains a module,
28
+ # not the first inline phrase like "`[BEGIN]` and `[DONE]`".
29
+ candidates = []
30
+ for m in re.finditer(r"\[BEGIN\](.*?)\[DONE\]", txt, re.S | re.I):
31
+ span = m.group(1)
32
+ if re.search(r"\bmodule\b", span) and "endmodule" in span:
33
+ candidates.append(span)
34
+ if candidates:
35
+ txt = candidates[-1]
36
+ else:
37
+ txt = txt.replace("```verilog", "```").replace("```systemverilog", "```")
38
+ fenced = [m.group(1) for m in re.finditer(r"```(?:\w+)?\s*(.*?)```", txt, re.S)]
39
+ module_fenced = [x for x in fenced if re.search(r"\bmodule\b", x) and "endmodule" in x]
40
+ if module_fenced:
41
+ txt = module_fenced[-1]
42
+ i = txt.find("module ")
43
+ if i < 0:
44
+ i = txt.find("module\n")
45
+ if i >= 0:
46
+ txt = txt[i:]
47
+ j = txt.rfind("endmodule")
48
+ if j >= 0:
49
+ txt = txt[: j + len("endmodule")]
50
+ return txt.strip() + "\n"
51
+
52
+
53
+ def model_loader_for(base):
54
+ cfg = AutoConfig.from_pretrained(base, trust_remote_code=True)
55
+ model_type = getattr(cfg, "model_type", "")
56
+ arch = " ".join(getattr(cfg, "architectures", []) or [])
57
+ if model_type in {"qwen3_5"} or "ForConditionalGeneration" in arch:
58
+ return AutoModelForImageTextToText
59
+ return AutoModelForCausalLM
60
+
61
+
62
+ def main():
63
+ ap = argparse.ArgumentParser()
64
+ ap.add_argument("--repo", default="/home/pablo/verilog-eval")
65
+ ap.add_argument("--build", required=True)
66
+ ap.add_argument("--base", required=True)
67
+ ap.add_argument("--adapter", default=None)
68
+ ap.add_argument("--limit", type=int, default=0)
69
+ ap.add_argument("--temperature", type=float, default=0.0)
70
+ ap.add_argument("--top_p", type=float, default=0.01)
71
+ ap.add_argument("--max_new_tokens", type=int, default=1536)
72
+ ap.add_argument("--allow-thinking", action="store_true")
73
+ args = ap.parse_args()
74
+
75
+ repo = Path(args.repo)
76
+ build = Path(args.build)
77
+ prompts = sorted((repo / "dataset_spec-to-rtl").glob("*_prompt.txt"))
78
+ if args.limit:
79
+ prompts = prompts[: args.limit]
80
+
81
+ bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True)
82
+ tok = AutoTokenizer.from_pretrained(args.adapter or args.base, trust_remote_code=True)
83
+ if tok.pad_token is None:
84
+ tok.pad_token = tok.eos_token
85
+ loader = model_loader_for(args.base)
86
+ model = loader.from_pretrained(args.base, quantization_config=bnb, device_map="auto", trust_remote_code=True)
87
+ if args.adapter:
88
+ model = PeftModel.from_pretrained(model, args.adapter)
89
+ model.eval()
90
+
91
+ for idx, p in enumerate(prompts, 1):
92
+ prob = p.name[:-11]
93
+ out = build / prob / f"{prob}_sample01.sv"
94
+ if out.exists() and out.stat().st_size > 10:
95
+ print(f"skip {idx}/{len(prompts)} {prob}", flush=True)
96
+ continue
97
+ spec = p.read_text(errors="ignore").strip()
98
+ suffix = THINKING_PROMPT_SUFFIX if args.allow_thinking else PROMPT_SUFFIX
99
+ system = THINKING_SYSTEM if args.allow_thinking else SYSTEM
100
+ full = f"Question:\n{spec}\n{suffix}\nAnswer:\n"
101
+ msgs = [{"role": "system", "content": system}, {"role": "user", "content": full}]
102
+ text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
103
+ inputs = tok(text, return_tensors="pt").to(model.device)
104
+ t0 = time.time()
105
+ with torch.no_grad():
106
+ gen = model.generate(
107
+ **inputs,
108
+ max_new_tokens=args.max_new_tokens,
109
+ do_sample=args.temperature > 0,
110
+ temperature=max(args.temperature, 1e-6),
111
+ top_p=args.top_p,
112
+ pad_token_id=tok.eos_token_id,
113
+ )
114
+ resp = tok.decode(gen[0][inputs["input_ids"].shape[1] :], skip_special_tokens=True)
115
+ code = extract(resp)
116
+ out.parent.mkdir(parents=True, exist_ok=True)
117
+ out.write_text(code)
118
+ (build / prob / f"{prob}_sample01_full_response.txt").write_text(resp)
119
+ print(f"gen {idx}/{len(prompts)} {prob} {time.time()-t0:.1f}s", flush=True)
120
+
121
+
122
+ if __name__ == "__main__":
123
+ main()
qwen35-9b-verilog-thinking-reinforced-lora/scripts/train_correction_adapter_any.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Train LoRA/QLoRA Verilog adapter on causal or conditional-generation HF models.
3
+
4
+ This is a compatibility variant for bases such as Qwen3.5 VLM/text models that
5
+ are not loadable via AutoModelForCausalLM. For normal coder models,
6
+ `src/train_correction_adapter.py` remains the default.
7
+ """
8
+ import argparse
9
+ import json
10
+ from pathlib import Path
11
+
12
+ import torch
13
+ from datasets import Dataset
14
+ from peft import LoraConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training
15
+ from transformers import (
16
+ AutoConfig,
17
+ AutoModelForCausalLM,
18
+ AutoModelForImageTextToText,
19
+ AutoTokenizer,
20
+ BitsAndBytesConfig,
21
+ DataCollatorForLanguageModeling,
22
+ Trainer,
23
+ TrainingArguments,
24
+ )
25
+
26
+ SYSTEM = "You are an expert Verilog designer. Return only complete synthesizable Verilog code. No explanation."
27
+
28
+
29
+ def load_rows(path):
30
+ rows = []
31
+ with open(path) as f:
32
+ for line in f:
33
+ if line.strip():
34
+ r = json.loads(line)
35
+ if "spec" not in r or "code" not in r:
36
+ raise ValueError(f"JSONL row missing spec/code: {r.keys()}")
37
+ rows.append(r)
38
+ return rows
39
+
40
+
41
+ def format_rows(rows, tokenizer):
42
+ texts = []
43
+ for r in rows:
44
+ if "messages" in r:
45
+ msg = r["messages"]
46
+ else:
47
+ assistant = r.get("assistant")
48
+ if not assistant:
49
+ assistant = "```verilog\n" + r["code"].strip() + "\n```"
50
+ msg = [
51
+ {"role": "system", "content": r.get("system", SYSTEM)},
52
+ {"role": "user", "content": r.get("user", r["spec"])},
53
+ {"role": "assistant", "content": assistant},
54
+ ]
55
+ texts.append(tokenizer.apply_chat_template(msg, tokenize=False, add_generation_prompt=False))
56
+ return texts
57
+
58
+
59
+ def build_dataset(rows, tokenizer, max_length, drop_overlength):
60
+ texts = format_rows(rows, tokenizer)
61
+ if drop_overlength:
62
+ kept, dropped = [], 0
63
+ for text in texts:
64
+ if len(tokenizer(text)["input_ids"]) <= max_length:
65
+ kept.append(text)
66
+ else:
67
+ dropped += 1
68
+ if not kept:
69
+ raise ValueError(f"all rows exceed max_length={max_length}; dropped={dropped}")
70
+ print(f"drop_overlength kept={len(kept)} dropped={dropped} max_length={max_length}", flush=True)
71
+ texts = kept
72
+ ds = Dataset.from_dict({"text": texts})
73
+
74
+ def enc(batch):
75
+ # Dynamic padding in the collator avoids padding every row to max_length.
76
+ # This is important for Qwen3.5-9B on L4: static 2048 padding OOMs.
77
+ out = tokenizer(batch["text"], max_length=max_length, truncation=not drop_overlength, padding=False)
78
+ return out
79
+
80
+ return ds.map(enc, batched=True, remove_columns=["text"])
81
+
82
+
83
+ def model_loader_for(base):
84
+ cfg = AutoConfig.from_pretrained(base, trust_remote_code=True)
85
+ model_type = getattr(cfg, "model_type", "")
86
+ arch = " ".join(getattr(cfg, "architectures", []) or [])
87
+ if model_type in {"qwen3_5"} or "ForConditionalGeneration" in arch:
88
+ return AutoModelForImageTextToText
89
+ return AutoModelForCausalLM
90
+
91
+
92
+ def main():
93
+ ap = argparse.ArgumentParser()
94
+ ap.add_argument("--base", required=True)
95
+ ap.add_argument("--adapter-in", default=None)
96
+ ap.add_argument("--train-jsonl", required=True)
97
+ ap.add_argument("--output", required=True)
98
+ ap.add_argument("--epochs", type=float, default=0.8)
99
+ ap.add_argument("--lr", type=float, default=1e-5)
100
+ ap.add_argument("--max-length", type=int, default=2048)
101
+ ap.add_argument("--batch-size", type=int, default=1)
102
+ ap.add_argument("--grad-accum", type=int, default=4)
103
+ ap.add_argument("--warmup-steps", type=int, default=40)
104
+ ap.add_argument("--lora-r", type=int, default=32)
105
+ ap.add_argument("--lora-alpha", type=int, default=64)
106
+ ap.add_argument("--logging-steps", type=int, default=2)
107
+ ap.add_argument("--save-steps", type=int, default=0)
108
+ ap.add_argument("--drop-overlength", action="store_true")
109
+ args = ap.parse_args()
110
+
111
+ rows = load_rows(args.train_jsonl)
112
+ tok_source = args.adapter_in or args.base
113
+ tokenizer = AutoTokenizer.from_pretrained(tok_source, trust_remote_code=True)
114
+ if tokenizer.pad_token is None:
115
+ tokenizer.pad_token = tokenizer.eos_token
116
+ ds = build_dataset(rows, tokenizer, args.max_length, args.drop_overlength)
117
+
118
+ bnb = BitsAndBytesConfig(
119
+ load_in_4bit=True,
120
+ bnb_4bit_quant_type="nf4",
121
+ bnb_4bit_compute_dtype=torch.float16,
122
+ bnb_4bit_use_double_quant=True,
123
+ )
124
+ loader = model_loader_for(args.base)
125
+ model = loader.from_pretrained(
126
+ args.base,
127
+ quantization_config=bnb,
128
+ device_map="auto",
129
+ trust_remote_code=True,
130
+ )
131
+ model = prepare_model_for_kbit_training(model)
132
+
133
+ if args.adapter_in:
134
+ model = PeftModel.from_pretrained(model, args.adapter_in, is_trainable=True)
135
+ else:
136
+ cfg = LoraConfig(
137
+ r=args.lora_r,
138
+ lora_alpha=args.lora_alpha,
139
+ lora_dropout=0.05,
140
+ bias="none",
141
+ task_type="CAUSAL_LM",
142
+ target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
143
+ )
144
+ model = get_peft_model(model, cfg)
145
+
146
+ save_strategy = "no" if args.save_steps == 0 else "steps"
147
+ train_args = TrainingArguments(
148
+ output_dir=str(Path(args.output).with_name(Path(args.output).name + "_ckpt")),
149
+ num_train_epochs=args.epochs,
150
+ per_device_train_batch_size=args.batch_size,
151
+ gradient_accumulation_steps=args.grad_accum,
152
+ learning_rate=args.lr,
153
+ warmup_steps=args.warmup_steps,
154
+ logging_steps=args.logging_steps,
155
+ save_strategy=save_strategy,
156
+ save_steps=args.save_steps if args.save_steps else 500,
157
+ report_to="none",
158
+ fp16=True,
159
+ )
160
+ trainer = Trainer(
161
+ model=model,
162
+ args=train_args,
163
+ train_dataset=ds,
164
+ data_collator=DataCollatorForLanguageModeling(tokenizer, mlm=False),
165
+ )
166
+ trainer.train()
167
+ model.save_pretrained(args.output)
168
+ tokenizer.save_pretrained(args.output)
169
+ print(f"saved {args.output}")
170
+
171
+
172
+ if __name__ == "__main__":
173
+ main()
qwen35-9b-verilog-thinking-reinforced-lora/tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": true,
13
+ "local_files_only": false,
14
+ "model_max_length": 262144,
15
+ "model_specific_special_tokens": {
16
+ "audio_bos_token": "<|audio_start|>",
17
+ "audio_eos_token": "<|audio_end|>",
18
+ "audio_token": "<|audio_pad|>",
19
+ "image_token": "<|image_pad|>",
20
+ "video_token": "<|video_pad|>",
21
+ "vision_bos_token": "<|vision_start|>",
22
+ "vision_eos_token": "<|vision_end|>"
23
+ },
24
+ "pad_token": "<|endoftext|>",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "Qwen2Tokenizer",
28
+ "unk_token": null,
29
+ "video_token": "<|video_pad|>",
30
+ "vision_bos_token": "<|vision_start|>",
31
+ "vision_eos_token": "<|vision_end|>"
32
+ }