Skip to content

Commit 3d683ab

Browse files
committed
Problem and in-context learning prompt fixes
1 parent 71f2df4 commit 3d683ab

11 files changed

+43
-41
lines changed

dataset_code-complete-iccad2023/Prob034_dff8_ref.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module RefModule (
66
);
77

88
initial
9-
q = 8'h0;
9+
q = 8'hx;
1010

1111
always @(posedge clk)
1212
q <= d;

pass_rate_to_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
data = result.stdout
1818

1919
# Parse the output data
20-
pattern = re.compile(r'\./build_(\S+)_(\S+)_shots(\d+)_n(\d+)/summary\.txt:pass_rate\s+=\s+(\d+\.\d+)')
20+
pattern = re.compile(r'\./build_([^_\s]+)_(\S+)_shots(\d+)_n(\d+)/summary\.txt:pass_rate\s+=\s+(\d+\.\d+)')
2121
matches = pattern.findall(data)
2222

2323
# Organize data into a dictionary

scripts/sv-generate

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ openai_models = [
7878
"gpt-3.5-turbo",
7979
"gpt-4",
8080
"gpt-4-turbo",
81+
"gpt-4o",
8182
]
8283

8384
nim_chat_models = [
@@ -95,7 +96,9 @@ nim_chat_models = [
9596
]
9697

9798
manual_models = [
98-
'manual-rtl-coder'
99+
'manual-rtl-coder',
100+
'manual-deepseek-coder-6.7b',
101+
'manual-deepseek-coder-33b'
99102
]
100103

101104
model_aliases = {
@@ -137,7 +140,7 @@ prompts = {}
137140

138141
prompts['code-complete-iccad2023'] = {
139142
'system_msg' : """
140-
You only complete chats with syntax correct Verilog code. End the Verilog module code completion with 'endmodule'. Do not include module, input and output definitions
143+
You only complete chats with syntax correct Verilog code. End the Verilog module code completion with 'endmodule'. Do not include module, input and output definitions.
141144
""",
142145
'prompt_prefix' : """
143146
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
@@ -146,8 +149,7 @@ You only complete chats with syntax correct Verilog code. End the Verilog module
146149

147150
prompts['spec-to-rtl'] = {
148151
'system_msg' : """
149-
You are a Verilog RTL designer that only writes code using correct
150-
Verilog syntax.
152+
You are a Verilog RTL designer that only writes code using correct Verilog syntax.
151153
""",
152154
'prompt_prefix' : ""
153155
}
@@ -161,17 +163,17 @@ Verilog syntax.
161163
prompt_rules_suffix="""
162164
Here are some additional rules and coding conventions.
163165
164-
- declare all ports and signals as logic; do not to use wire or reg
166+
- Declare all ports and signals as logic; do not to use wire or reg.
165167
166-
- for combinational logic with an always block do not explicitly specify
167-
the sensitivity list; instead use always @(*)
168+
- For combinational logic with an always block do not explicitly specify
169+
the sensitivity list; instead use always @(*).
168170
169-
- all sized numeric constants must have a size greater than zero
170-
(e.g, 0'b0 is not a valid expression)
171+
- All sized numeric constants must have a size greater than zero
172+
(e.g, 0'b0 is not a valid expression).
171173
172-
- an always block must read at least one signal otherwise it will never
174+
- An always block must read at least one signal otherwise it will never
173175
be executed; use an assign statement instead of an always block in
174-
situations where there is no need to read any signals
176+
situations where there is no need to read any signals.
175177
176178
- if the module uses a synchronous reset signal, this means the reset
177179
signal is sampled with respect to the clock. When implementing a

scripts/verilog-example-prefix_code-complete-iccad2023_1-shot.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
1+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
22
//
33
// The module should implement an incrementer which increments the input by
44
// one and writes the result to the output. Assume all values are encoded as

scripts/verilog-example-prefix_code-complete-iccad2023_2-shot.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
1+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
22
//
33
// The module should implement an incrementer which increments the input by
44
// one and writes the result to the output. Assume all values are encoded as
@@ -16,7 +16,7 @@ module TopModule
1616

1717
endmodule
1818

19-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
19+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
2020
//
2121
// The module should implement an 8-bit registered incrementer with an
2222
// active-high synchronous reset. The 8-bit input is first registered and

scripts/verilog-example-prefix_code-complete-iccad2023_3-shot.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
1+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
22
//
33
// The module should implement an incrementer which increments the input by
44
// one and writes the result to the output. Assume all values are encoded as
@@ -16,7 +16,7 @@ module TopModule
1616

1717
endmodule
1818

19-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
19+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
2020
//
2121
// The module should implement an 8-bit registered incrementer with an
2222
// active-high synchronous reset. The 8-bit input is first registered and
@@ -58,7 +58,7 @@ module TopModule
5858

5959
endmodule
6060

61-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
61+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
6262
//
6363
// Build a finite-state machine that takes as input a
6464
// serial bit stream and outputs a one whenever the bit stream contains two

scripts/verilog-example-prefix_code-complete-iccad2023_4-shot.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
1+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
22
//
33
// The module should implement a XOR gate.
44

@@ -13,7 +13,7 @@ module TopModule
1313

1414
endmodule
1515

16-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
16+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
1717
//
1818
// The module should implement an 8-bit registered incrementer. The 8-bit
1919
// input is first registered and then incremented by one on the next cycle.
@@ -54,7 +54,7 @@ module TopModule
5454

5555
endmodule
5656

57-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
57+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
5858
//
5959
// The module should implement an n-bit registered incrementer where the
6060
// bitwidth is specified by the parameter nbits. The n-bit input is first
@@ -99,7 +99,7 @@ module TopModule
9999
endmodule
100100

101101

102-
// Implement the Verilog module based on the following description. Assume that sigals are positive clock/clk triggered unless otherwise stated.
102+
// Implement the Verilog module based on the following description. Assume that signals are positive clock/clk triggered unless otherwise stated.
103103
//
104104
// Build a finite-state machine that takes as input a
105105
// serial bit stream and outputs a one whenever the bit stream contains two

scripts/verilog-example-prefix_spec-to-rtl_1-shot default.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Assume all sequential logic is triggered on the positive edge of the
1616
clock. The reset input is active high synchronous and should reset the
1717
output to zero.
1818

19-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
19+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
2020
and do NOT output anything else.
2121

2222
Answer:
23-
<CODE>
23+
[BEGIN]
2424
module TopModule
2525
#(
2626
parameter nbits
@@ -55,4 +55,4 @@ module TopModule
5555
assign out = temp_wire;
5656

5757
endmodule
58-
</CODE>
58+
[DONE]

scripts/verilog-example-prefix_spec-to-rtl_2-shot.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ reset to zero when the reset input is one. Assume all values are encoded
4343
as two's complement binary numbers. Assume all sequential logic is
4444
triggered on the positive edge of the clock.
4545

46-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
46+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
4747
and do NOT output anything else.
4848

4949
Answer:

scripts/verilog-example-prefix_spec-to-rtl_3-shot.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ reset to zero when the reset input is one. Assume all values are encoded
4343
as two's complement binary numbers. Assume all sequential logic is
4444
triggered on the positive edge of the clock.
4545

46-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
46+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
4747
and do NOT output anything else.
4848

4949
Answer:
@@ -100,7 +100,7 @@ Assume all sequential logic is triggered on the positive edge of the
100100
clock. The reset input is active high synchronous and should reset the
101101
finite-state machine to an appropriate initial state.
102102

103-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
103+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
104104
and do NOT output anything else.
105105

106106
Answer:

scripts/verilog-example-prefix_spec-to-rtl_4-shot.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ All input and output ports are one bit unless otherwise specified.
99

1010
The module should implement a XOR gate.
1111

12-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
12+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
1313
and do NOT output anything else.
1414

1515
Answer:
16-
<CODE>
16+
[BEGIN]
1717
module TopModule
1818
(
1919
input logic in0,
@@ -24,7 +24,7 @@ module TopModule
2424
assign out = in0 ^ in1;
2525

2626
endmodule
27-
</CODE>
27+
[DONE]
2828

2929
Question:
3030
Implement a hardware module named TopModule with the following interface.
@@ -42,11 +42,11 @@ Assume all sequential logic is triggered on the positive edge of the
4242
clock. The reset input is active high synchronous and should reset the
4343
output to zero.
4444

45-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
45+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
4646
and do NOT output anything else.
4747

4848
Answer:
49-
<CODE>
49+
[BEGIN]
5050
module TopModule
5151
(
5252
input logic clk,
@@ -79,7 +79,7 @@ module TopModule
7979
assign out = temp_wire;
8080

8181
endmodule
82-
</CODE>
82+
[DONE]
8383

8484
Question:
8585
Implement a hardware module named TopModule with the following interface.
@@ -99,11 +99,11 @@ Assume all sequential logic is triggered on the positive edge of the
9999
clock. The reset input is active high synchronous and should reset the
100100
output to zero.
101101

102-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
102+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
103103
and do NOT output anything else.
104104

105105
Answer:
106-
<CODE>
106+
[BEGIN]
107107
module TopModule
108108
#(
109109
parameter nbits
@@ -138,7 +138,7 @@ module TopModule
138138
assign out = temp_wire;
139139

140140
endmodule
141-
</CODE>
141+
[DONE]
142142

143143
Question:
144144
Implement a hardware module named TopModule with the following interface.
@@ -158,11 +158,11 @@ Assume all sequential logic is triggered on the positive edge of the
158158
clock. The reset input is active high synchronous and should reset the
159159
finite-state machine to an appropriate initial state.
160160

161-
Enclose your code with <CODE> and </CODE>. Only output the code snippet
161+
Enclose your code with [BEGIN] and [DONE]. Only output the code snippet
162162
and do NOT output anything else.
163163

164164
Answer:
165-
<CODE>
165+
[BEGIN]
166166
module TopModule
167167
(
168168
input logic clk,
@@ -212,4 +212,4 @@ module TopModule
212212
end
213213

214214
endmodule
215-
</CODE>
215+
[DONE]

0 commit comments

Comments
 (0)