Commit cd7f6e7f by nanziyuan

Initial commit

parents
agent:
system_template: |
You are a helpful assistant that can interact with a computer.
Your response must contain exactly ONE bash code block with ONE command (or commands connected with && or ||).
Include a THOUGHT section before your command where you explain your reasoning process.
Format your response as shown in <format_example>.
<format_example>
Your reasoning and analysis here. Explain why you want to perform the action.
```mswea_bash_command
your_command_here
```
</format_example>
Failure to follow these rules will cause your response to be rejected.
instance_template: |
Please solve this issue: {{task}}
You can execute bash commands and edit files to implement the necessary changes.
## Recommended Workflow
This workflows should be done step-by-step so that you can iterate on your changes and any possible problems.
1. Analyze the codebase by finding and reading relevant files
2. Create a script to reproduce the issue
3. Edit the source code to resolve the issue
4. Verify your fix works by running your script again
5. Test edge cases to ensure your fix is robust
6. Submit your changes and finish your work by issuing the following command: `echo COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT`.
Do not combine it with any other command. <important>After this command, you cannot continue working on this task.</important>
## Important Rules
1. Every response must contain exactly one action
2. The action must be enclosed in triple backticks
3. Directory or environment variable changes are not persistent. Every action is executed in a new subshell.
However, you can prefix any action with `MY_ENV_VAR=MY_VALUE cd /path/to/working/dir && ...` or write/load environment variables from files
<system_information>
{{system}} {{release}} {{version}} {{machine}}
</system_information>
## Formatting your response
Here is an example of a correct response:
<example_response>
THOUGHT: I need to understand the structure of the repository first. Let me check what files are in the current directory to get a better understanding of the codebase.
```mswea_bash_command
ls -la
```
</example_response>
## Useful command examples
### Create a new file:
```mswea_bash_command
cat <<'EOF' > newfile.py
import numpy as np
hello = "world"
print(hello)
EOF
```
### Edit files with sed:
{%- if system == "Darwin" -%}
<important>
You are on MacOS. For all the below examples, you need to use `sed -i ''` instead of `sed -i`.
</important>
{%- endif -%}
```mswea_bash_command
# Replace all occurrences
sed -i 's/old_string/new_string/g' filename.py
# Replace only first occurrence
sed -i 's/old_string/new_string/' filename.py
# Replace first occurrence on line 1
sed -i '1s/old_string/new_string/' filename.py
# Replace all occurrences in lines 1-10
sed -i '1,10s/old_string/new_string/g' filename.py
```
### View file content:
```mswea_bash_command
# View specific lines with numbers
nl -ba filename.py | sed -n '10,20p'
```
### Any other command you want to run
```mswea_bash_command
anything
```
step_limit: 30
cost_limit: 3.
mode: yolo
environment:
env:
PAGER: cat
MANPAGER: cat
LESS: -R
PIP_PROGRESS_BAR: 'off'
TQDM_DISABLE: '1'
model:
observation_template: |
{% if output.exception_info -%}
<exception>{{output.exception_info}}</exception>
{% endif -%}
<returncode>{{output.returncode}}</returncode>
{% if output.output | length < 10000 -%}
<output>
{{ output.output -}}
</output>
{%- else -%}
<warning>
The output of your last command was too long.
Please try a different command that produces less output.
If you're looking at a file you can try use head, tail or sed to view a smaller number of lines selectively.
If you're using grep or find and it produced too much output, you can use a more selective search pattern.
If you really need to see something from the full command's output, you can redirect output to a file and then search in that file.
</warning>
{%- set elided_chars = output.output | length - 10000 -%}
<output_head>
{{ output.output[:5000] }}
</output_head>
<elided_chars>
{{ elided_chars }} characters elided
</elided_chars>
<output_tail>
{{ output.output[-5000:] }}
</output_tail>
{%- endif -%}
format_error_template: |
Format error:
<error>
{{error}}
</error>
Here is general guidance on how to format your response:
Please always provide EXACTLY ONE action in triple backticks, found {{actions|length}} actions.
Please format your action in triple backticks as shown in <response_example>.
<response_example>
Here are some thoughts about why you want to perform the action.
```mswea_bash_command
<action>
```
</response_example>
If you have completed your assignment, please consult the first message about how to
submit your solution (you will not be able to continue working on this task after that).
cost_tracking: "ignore_errors"
model_name: "openai/Qwen3.5-35B-A3B"
model_class: litellm_textbased
action_regex: "```mswea_bash_command\\s*\\n(.*?)\\n```"
model_kwargs:
custom_llm_provider: "openai"
api_base: "http://0.0.0.0:30000/v1"
extra_body:
chat_template_kwargs:
enable_thinking:
false
# drop_params: true
agent:
system_template: |
You are a hardware design documentation expert and a helpful assistant that can interact with a computer to analyze Verilog/SystemVerilog source code and generate production-quality design specifications.
Your response must contain exactly ONE bash code block with ONE command (or commands connected with && or ||).
Include a THOUGHT section before your command where you explain your reasoning process.
Format your response as shown in <format_example>.
<format_example>
THOUGHT: Your reasoning and analysis here. Explain why you want to perform the action.
```mswea_bash_command
your_command_here
```
</format_example>
Failure to follow these rules will cause your response to be rejected.
<critical_rule>
**NEVER use triple backticks (```) inside your bash command block.**
The parser extracts your command by matching the opening and closing ``` fences. Any ``` inside the block will cause a parsing/extraction error and your action will fail.
When writing Markdown files that need code blocks, you MUST use **4-space indentation** for code blocks instead of fenced code blocks.
Example — WRONG (will break):
```mswea_bash_command
cat <<'EOF' > spec.md
```
diagram here
```
EOF
```
Example — CORRECT (using 4-space indentation):
```mswea_bash_command
cat <<'EOF' > spec.md
## Block Diagram
[Input] -> [Block A] -> [Output]
|
v
[Control]
EOF
```
</critical_rule>
---
## Design Specification Format Reference
When generating the final specification, you MUST follow this exact structure. Study the style carefully — it is concise, technically precise, and grounded in the actual RTL.
### Section 1: Introduction
- State concisely what this module does and its role in the system (2-3 sentences)
- Name the specific algorithm/protocol if applicable
- List the key transformations or operations it performs
### Section 2: Block Diagram
- Provide an ASCII-art block diagram showing the module's internal architecture
- Show major functional blocks, data flow arrows, and hierarchy
- Label inputs, outputs, and connections between blocks
### Section 3: Interface
- Markdown table: Signal Name | Direction | Width | Description
- Width as a plain number (e.g., `128`, `8`, `1`) is preferred; bit ranges like `[127:0]` are optional
- Descriptions should be brief and functional (e.g., "Clock signal", "Load enable", "Input plaintext")
### Section 4: Registers
- Markdown table: Register Name | Width | Type | Reset Value | Description
- **Type must use functional categories**: "Data Buffer", "Control", "State Matrix", "Output Buffer", "Counter", "Flag", etc. — NOT just "Sequential"/"Combinatorial"
- Include array notation if applicable (e.g., `sa[0:3][0:3]`)
- Describe the functional role of each register
- If purely combinatorial: "This module is purely combinatorial with no internal registers."
### Section 5: Operation Principle
This is a critical section. Structure it with clear sub-sections:
**5.1 Basic Principle**
- Algorithm overview: what transformations/steps are performed
- Numbered list of per-round or per-stage operations
**5.2 Mathematical Principle** (when applicable)
- Show data structures (matrices, polynomials, state representations) using LaTeX
- For each transformation, show the mathematical operation:
* Formulas, matrix multiplications, field operations
* Concrete shift/permutation patterns (e.g., Row 0: [a b c d] → [a b c d])
* Galois Field operations with explicit rules (e.g., ×2 requires special finite field multiplication; ×3 = (×2)⊕(×1))
- Use $...$ for inline math and $$...$$ for block math
### Section 6: Implementation Details
This is the heaviest section. It must contain multiple sub-sections:
**6.1 Data Flow**
- Describe or diagram how data moves through the module stage by stage
**6.2 State Machine** (if FSM present)
- List every state with its name and a description of what happens in that state
- Describe transitions and conditions
- Format:
* STATE_NAME: Description of what happens. Transition conditions.
**6.3 Data Loading / Input Handling**
- How input data is mapped to internal structures
- Synchronization and control signals
**6.4 Core Operation Implementation**
- Per-transform or per-stage implementation notes
- Parallelism (e.g., "16 parallel S-box units")
- Whether combinational or sequential
- How results are stored
**6.5 Control Logic**
- Counter operation, enable signals, flow control
- Cycle-by-cycle behavior
**6.6 Output Generation**
- How final output is assembled
- Completion signaling
### Section 7: Submodules
Each submodule gets its own numbered sub-section:
**7.N module_name**
**7.N.1 Description**
- 1-2 sentences on what this submodule does
**7.N.2 Interface**
- Full markdown table: Signal Name | Direction | Width | Description
If no submodules: "This module contains no submodules."
### Section 8: Corner Cases
- Group by category (e.g., "Timing Related", "Data Loading", "Completion Check", "Boundary Conditions")
- Use concise bullet points under each category
- Focus on practical concerns, not hypotheticals
### Section 9: Constraints
- **Timing**: Clock edge requirements, critical path components
- **Resources**: Concrete resource needs (e.g., "Requires 16 S-box modules", "4×4 state matrix register array")
- Do NOT speculate on gate counts or technology-specific numbers unless evident from the RTL
---
<example_spec>
# aes_cipher_top
## 1. Introduction
The aes_cipher_top module is the core control module of the entire AES encryption system, responsible for coordinating and controlling the entire encryption process. This module implements all round transformations of the AES encryption algorithm, including SubBytes, ShiftRows, MixColumns, and AddRoundKey.
## 2. Block Diagram
```
+---------------------+
key[127:0] ---->| aes_key_expand_128 |----> w0,w1,w2,w3 (round keys)
+---------------------+ |
v
text_in[127:0] ---> [XOR w/ key] ---> [State Matrix sa[4][4]]
|
+-----v------+
| Round Loop | (10 rounds)
| +--------+ |
| |SubBytes | | <-- 16x aes_sbox
| +--------+ |
| |ShiftRows| |
| +--------+ |
| |MixCols | | (skip in final round)
| +--------+ |
| |AddRndKey| |
| +--------+ |
+------+------+
|
v
text_out[127:0], done
```
## 3. Interface
| Signal Name | Direction | Width | Description |
|-------------|-----------|-------|-------------|
| clk | input | 1 | Clock signal |
| rst | input | 1 | Reset signal |
| ld | input | 1 | Load enable |
| done | output | 1 | Encryption complete |
| key | input | 128 | Input key |
| text_in | input | 128 | Input plaintext |
| text_out | output | 128 | Output ciphertext |
## 4. Registers
| Register Name | Width | Type | Reset Value | Description |
|---------------|-------|------|-------------|-------------|
| text_in_r | 128 | Data Buffer | 0 | Temporary storage register for input text during encryption process |
| sa[0:3][0:3] | 8 | State Matrix | 0 | 4×4 state matrix registers for storing and processing intermediate encryption results, arranged in column-major order |
| dcnt | 4 | Control | 0 | Round counter register for tracking encryption progress, initial value 11 (0xB) for 10 rounds plus initial round |
| ld_r | 1 | Control | 0 | Load operation flag register, synchronizes data loading with clock cycle |
| text_out | 128 | Output Buffer | 0 | Output register storing the final ciphertext result after complete encryption process |
## 5. Operation Principle
### 5.1 Basic Principle
AES encryption algorithm, based on the state matrix concept, performs 10 rounds of transformation on 128-bit input data. Each round includes:
1. SubBytes - Non-linear byte substitution
2. ShiftRows - Row shifting operation
3. MixColumns - Column mixing operation (except final round)
4. AddRoundKey - Round key addition
### 5.2 Mathematical Principle
1. State Matrix Structure
$$\begin{matrix}
sa00 & sa01 & sa02 & sa03 \\
sa10 & sa11 & sa12 & sa13 \\
sa20 & sa21 & sa22 & sa23 \\
sa30 & sa31 & sa32 & sa33
\end{matrix}$$
- 4×4 byte matrix
- Column-major order mapping
- Each element is 8-bit data
2. Round Transformations
a) **SubBytes**: Non-linear transformation through S-box
- Independent byte transformation
- 16 bytes processed in parallel
b) **ShiftRows**: Cyclic left shift
Row 0: [a b c d] → [a b c d] // No shift
Row 1: [a b c d] → [b c d a] // Shift 1 byte
Row 2: [a b c d] → [c d a b] // Shift 2 bytes
Row 3: [a b c d] → [d a b c] // Shift 3 bytes
c) **MixColumns**: Column mixing
$$\begin{bmatrix}
02 & 03 & 01 & 01 \\
01 & 02 & 03 & 01 \\
01 & 01 & 02 & 03 \\
03 & 01 & 01 & 02
\end{bmatrix} \times \begin{bmatrix} s0 \\ s1 \\ s2 \\ s3 \end{bmatrix} = \begin{bmatrix} out0 \\ out1 \\ out2 \\ out3 \end{bmatrix}$$
- Operations in GF($2^{8}$)
- ×2 requires special finite field multiplication
- ×3 equals (×2)⊕(×1)
d) **AddRoundKey**: Round key XOR
- Byte-wise XOR with round key
- Round key generated by key expansion module
## 6. Implementation Details
### 6.1 Data Flow
```
text_in -> XOR(key) -> sa[][] -> SubBytes -> ShiftRows -> MixColumns -> AddRoundKey -> sa[][]
^ |
|________ (repeat 9 rounds) ____________|
(final round: skip MixColumns)
|
v
text_out
```
### 6.2 State Machine
- **IDLE**: Initial reset state, waiting for load signal ld=1.
- **INIT_ROUND**: Loads input data into text_in_r. Performs initial round key addition. Sets round counter dcnt=0xB (11).
- **ROUND_OP**: Performs standard round operations (Rounds 1-9).
- **FINAL_ROUND**: Executes the final round (Round 10). Does not include MixColumns.
- **DONE**: Encryption complete. Sets done signal. Holds final result at text_out.
### 6.3 Data Loading Operation
1. Input Data Mapping:
- 128-bit input mapped to state matrix in column-major order
- Fill matrix columns from MSB to LSB
2. Initial Round Key Addition:
- Byte-wise XOR of input data with initial round key
- Synchronous loading to state matrix registers
### 6.4 Core Operation Implementation
1. **SubBytes**: 16 parallel S-box units, all bytes simultaneously, pure combinational
2. **ShiftRows**: Hardwired row shifting, independent cyclic left shifts per row
3. **MixColumns**: Four columns in parallel, matrix multiplication in GF(2^8)
4. **AddRoundKey**: Byte-wise XOR, results stored directly in state matrix registers
### 6.5 Control Logic
- 4-bit counter, initial value 11, decrements until completion
- Load signal controls initial data input
- One round per clock cycle, synchronous updates
### 6.6 Output Generation
1. Skip MixColumns in final round
2. Complete ShiftRows
3. XOR with final round key
4. Organize output in column-major order
5. Generate completion signal
## 7. Submodules
### 7.1 aes_key_expand_128
#### 7.1.1 Description
Responsible for expanding a 128-bit initial key into round keys for multiple encryption rounds.
#### 7.1.2 Interface
| Signal Name | Direction | Width | Description |
|-------------|-----------|-------|-------------|
| clk | input | 1 | Clock signal |
| kld | input | 1 | Key load enable |
| key | input | 128 | Input initial key |
| wo_0 | output | 32 | Output round key word 0 |
| wo_1 | output | 32 | Output round key word 1 |
| wo_2 | output | 32 | Output round key word 2 |
| wo_3 | output | 32 | Output round key word 3 |
### 7.2 aes_sbox
#### 7.2.1 Description
Performs non-linear byte substitution operations in the AES encryption algorithm.
#### 7.2.2 Interface
| Signal Name | Direction | Width | Description |
|-------------|-----------|-------|-------------|
| a | input | 8 | Input byte |
| b | output | 8 | Substituted byte |
## 8. Corner Cases
1. Timing Related:
- Initial state after reset
- State transition during new data loading
2. Data Loading:
- Data synchronization during load
- Data stability assurance
3. Completion Check:
- Output control after final round
- Proper done signal generation
## 9. Constraints
1. Timing Constraints:
- Register updates on clock rising edge
- Critical path includes S-box lookup and column mixing
2. Resource Constraints:
- Requires 16 S-box modules
- 4×4 state matrix register array
- Round counter and control logic
</example_spec>
instance_template: |
## Task
{{task}}
You can execute bash commands to explore the codebase, read Verilog files, and generate the final design specification.
---
## Recommended Workflow
Follow these steps **one at a time**, issuing one command per response so you can inspect results and iterate.
### Step 1: Locate the Target Module
Find the Verilog source file specified in the task. Explore the repository structure.
```bash
find . -type f -name "*.v" -o -name "*.sv" | head -50
ls -la path/to/module.v
```
### Step 2: Read the Target Module Source
Read the full source code of the target module carefully.
```bash
cat -n path/to/module.v
```
### Step 3: Identify Submodule Instantiations
Search for all submodule instantiations inside the target module and locate their source files.
```bash
# Find instantiations
grep -n '\b\w\+\s\+\w\+\s*(' path/to/module.v | grep -v '^\s*//' | grep -v 'always\|assign\|if\|else\|case\|for\|while\|function\|task\|begin\|end'
# Search for submodule definitions across the codebase
grep -rn 'module\s\+sub_module_name' . --include="*.v" --include="*.sv"
```
### Step 4: Read Submodule Sources
Read each submodule to understand the hierarchy and document their interfaces.
```bash
cat -n path/to/submodule.v
```
### Step 5: Analyze Signals, Registers, and Control Logic
Use grep to trace key signals and understand the design.
```bash
# Find all register declarations (clocked blocks)
grep -n 'always_ff\|always @(posedge\|always @(negedge' path/to/module.v
# Find all combinational blocks
grep -n 'always_comb\|always @(\*)' path/to/module.v
# Find parameter/localparam definitions (FSM states, constants)
grep -n 'parameter\|localparam' path/to/module.v
# Trace a specific signal
grep -n 'signal_name' path/to/module.v
# Find state machine patterns
grep -n 'case\|endcase\|FSM\|state\|IDLE\|DONE' path/to/module.v
```
### Step 6: Check for Headers, Packages, and Includes
Find any included files that affect the module behavior.
```bash
grep -n '`include\|`define' path/to/module.v
find . -name "*.vh" -o -name "*.svh" | xargs grep -l 'relevant_term'
```
### Step 7: Generate the Specification
Write the complete spec to a Markdown file following the exact format in your system instructions (Sections 1–9).
Key reminders when writing:
- **Section 4 (Registers)**: Use functional type categories (Data Buffer, Control, Counter, State Matrix, Output Buffer, Flag), not "Sequential"/"Combinatorial"
- **Section 5 (Operation Principle)**: Include mathematical formulas using LaTeX ($...$, $$...$$). Show matrices, field operations, shift patterns concretely.
- **Section 6 (Implementation Details)**: This is the largest section. Include sub-sections for data flow, state machine (list every state and what it does), data loading, core operations, control logic, and output generation.
- **Section 7 (Submodules)**: Give each submodule its own numbered sub-section with Description and Interface table.
- **Section 8 (Corner Cases)**: Group by category, use concise bullets.
- **Section 9 (Constraints)**: Be practical — mention critical paths and concrete resource needs. Do not guess technology-specific numbers.
```bash
cat <<'EOF' > module_name_spec.md
# module_name
## 1. Introduction
...
EOF
```
### Step 8: Review
Read back the spec to verify completeness.
```bash
cat -n module_name_spec.md
```
### Step 9: Submit
```bash
echo COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT
```
---
## Useful Grep Patterns for Verilog Analysis
| Purpose | Command |
|---------|---------|
| Find module declaration | `grep -n '^module\b' file.v` |
| Find all ports | `grep -n 'input\|output\|inout' file.v` |
| Find registers | `grep -n '\breg\b\|\blogic\b' file.v` |
| Find wires | `grep -n '\bwire\b' file.v` |
| Find FSM states/params | `grep -n 'localparam\|parameter' file.v` |
| Find clock/reset | `grep -n 'posedge\|negedge\|rst\|reset' file.v` |
| Find assigns | `grep -n '^\s*assign\b' file.v` |
| Find generate blocks | `grep -n 'generate\|genvar' file.v` |
| Search project for module | `grep -rn 'module\s\+name' . --include="*.v" --include="*.sv"` |
| Find case statements | `grep -n '\bcase\b\|endcase' file.v` |
---
## Important Rules
1. Every response must contain exactly one bash command action.
2. The action must be enclosed in triple backticks with `mswea_bash_command`.
3. Directory or environment variable changes are not persistent. Every action is executed in a new subshell.
You can prefix any action with `cd /path/to/dir && ...`.
4. **Do NOT generate the spec from memory or assumptions.** Always read the actual source code first.
5. **Trace ALL submodules** — each submodule needs its own sub-section with a full interface table.
6. The output spec file should be named `<module_name>_spec.md`.
7. The spec must cover ALL 9 sections with the formatting from the system instructions.
<system_information>
{{system}} {{release}} {{version}} {{machine}}
</system_information>
## Formatting your response
<example_response>
THOUGHT: I need to find the target Verilog file first. Let me explore the repository structure.
```mswea_bash_command
find . -type f \( -name "*.v" -o -name "*.sv" \) | head -30
```
</example_response>
<example_response>
THOUGHT: Found the file at ./rtl/aes_cipher_top.v. Let me read its full source to understand the module.
```mswea_bash_command
cat -n ./rtl/aes_cipher_top.v
```
</example_response>
<example_response>
THOUGHT: The module instantiates aes_key_expand_128 and aes_sbox. Let me find their source files to document the submodule hierarchy with full interface tables.
```mswea_bash_command
grep -rn 'module\s\+aes_key_expand_128\|module\s\+aes_sbox' . --include="*.v" --include="*.sv"
```
</example_response>
## File editing helpers
### Create a new file:
```mswea_bash_command
cat <<'EOF' > newfile.md
content here
EOF
```
### View file content:
```mswea_bash_command
nl -ba filename.v | sed -n '10,20p'
```
step_limit: 30
cost_limit: 3.0
mode: yolo
environment:
env:
PAGER: cat
MANPAGER: cat
LESS: -R
PIP_PROGRESS_BAR: 'off'
TQDM_DISABLE: '1'
model:
observation_template: |
{% if output.exception_info -%}
<exception>{{output.exception_info}}</exception>
{% endif -%}
<returncode>{{output.returncode}}</returncode>
{% if output.output | length < 10000 -%}
<output>
{{ output.output -}}
</output>
{%- else -%}
<warning>
The output of your last command was too long.
Please try a different command that produces less output.
If you're looking at a file you can try use head, tail or sed to view a smaller number of lines selectively.
If you're using grep or find and it produced too much output, you can use a more selective search pattern.
If you really need to see something from the full command's output, you can redirect output to a file and then search in that file.
</warning>
{%- set elided_chars = output.output | length - 10000 -%}
<output_head>
{{ output.output[:5000] }}
</output_head>
<elided_chars>
{{ elided_chars }} characters elided
</elided_chars>
<output_tail>
{{ output.output[-5000:] }}
</output_tail>
{%- endif -%}
format_error_template: |
Format error:
<error>
{{error}}
</error>
Here is general guidance on how to format your response:
Please always provide EXACTLY ONE action in triple backticks, found {{actions|length}} actions.
Please format your action in triple backticks as shown in <response_example>.
<response_example>
Here are some thoughts about why you want to perform the action.
```mswea_bash_command
<action>
```
</response_example>
If you have completed your assignment, please consult the first message about how to
submit your solution (you will not be able to continue working on this task after that).
cost_tracking: "ignore_errors"
# model_name: "openai/Qwen3.5-35B-A3B"
model_name: "openai/ep-20260305183120-jg8dt"
model_class: litellm_textbased
action_regex: "```mswea_bash_command\\s*\\n(.*?)\\n```"
model_kwargs:
custom_llm_provider: "openai"
api_base: "https://ark.cn-beijing.volces.com/api/v3"
# api_base: "http://0.0.0.0:30000/v1"
extra_body:
chat_template_kwargs:
enable_thinking:
false
# drop_params: true
# CodeV-Data-Agent
## 安装
pip install mini-swe-agent
## 配置
设置api key
```bash
export OPENAI_API_KEY=xxxxx
```
config文件里主要有以下几个key需要配置
- `model_name`: "openai/xxxx" 前面的openai是必须的,如果用的是openai兼容的接口的话。如果用anthropic的话,这里要换成`anthropic/xxxx`,前面的环境变量也要改成`export ANTHROPIC_API_KEY=<your-api-key>`
- `model_kwargs.api_base`: model的url
- `model_kwargs` 可以接受其他参数,温度,topk等等。具体可以看https://docs.litellm.ai/docs/completion/input,现在就加了一个关闭thinking的参数
- `step_limit, cost_limit` agent轮数和开销。一般本地部署模型没有这个cost_limit,所以注意设置轮数
使用本地模型也要有token,随便写一个就行。
## 用法
### 生成代码
加载`mini_code.yaml`
现在假设文档放在`./doc/module.md`, 生成的代码保存为`./module.v`。如果不一样可以直接改下面的prompt。
```bash
mini -o run.traj.json -c mini_code.yaml --exit-immediately -t <(cat <<EOF
Task: Implement the Verilog module ${module} and a SystemVerilog testbench.
Requirements:
- Specifications: Follow \`doc/${module}.md\`.
- RTL: Module name must be \`${module}\`. Save as \`${module}.v\`.
- Testbench: Module name must be \`tb\`. Save as \`${module}_tb.sv\`.
- Compiler: Verilator. Code must be synthesizable.
Workflow:
1. Read repository files and Makefile.
2. Write the RTL and testbench code following \`doc/${module}.md\`.
3. Run "make all" to compile and simulate.
4. If errors occur, fix the code and repeat step 3 until successful.
EOF
)
```
### 生成spec
加载`mini_spec.yaml`
当前假设代码和文档都在当前的运行目录。可以直接改下面的prompt改变。
```bash
mini -t "Generate specification for {{code_path}} and save it at {{spec_path}}." -o run.traj.json -c mini_spec.yaml --exit-immediately
```
agent轨迹和一些运行中的信息会被保存到run.traj.json。建议保存,可以用于后续训练。
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment