Skip to content

Commit 71f2df4

Browse files
committed
Fixing problem prompts and testbenches for better consistency and accuracy.
1 parent 508a4df commit 71f2df4

29 files changed

+233
-408
lines changed

dataset_code-complete-iccad2023/Prob045_edgedetect2_prompt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
For each bit in an 8-bit vector, detect when the input signal changes
33
from one clock cycle to the next (detect any edge). The output bit should
4-
be set the cycle after a 0 to 1 transition occurs.
4+
be set the cycle after a 0 to 1 or 1 to 0 transition occurs.
55

66
module TopModule (
77
input clk,

dataset_code-complete-iccad2023/Prob074_ece241_2014_q4_prompt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Build this circuit in Verilog.
66

77
Input x goes to three different two-input gates: a XOR, an AND, and a OR
88
gate. Each of the three gates is connected to the input of a D flip-flop
9-
and then the flip-flop outputs all go to a three-input XNOR, whose output
9+
and then the flip-flop outputs all go to a three-input NOR, whose output
1010
is Z. The second input of the XOR is its corresponding flip-flop's
1111
output, the second input of the AND is its corresponding flip-flop's
1212
complemented output, and finally the second input of the OR is its

dataset_code-complete-iccad2023/Prob079_fsm3onehot_test.sv

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,13 @@ module stimulus_gen (
1010
input tb_match
1111
);
1212

13-
int errored1 = 0;
14-
int onehot_error = 0;
15-
1613
initial begin
1714
// Test the one-hot cases first.
1815
repeat(200) @(posedge clk, negedge clk) begin
1916
state <= 1<< ($unsigned($random) % 4);
2017
in <= $random;
21-
if (!tb_match) onehot_error++;
2218
end
2319

24-
25-
// Random.
26-
errored1 = 0;
27-
repeat(400) @(posedge clk, negedge clk) begin
28-
state <= $random;
29-
in <= $random;
30-
if (!tb_match)
31-
errored1++;
32-
end
33-
if (!onehot_error && errored1)
34-
$display ("Hint: Your circuit passed when given only one-hot inputs, but not with random inputs.");
35-
36-
if (!onehot_error && errored1)
37-
$display("Hint: Are you doing something more complicated than deriving state transition equations by inspection?\n");
38-
3920
#1 $finish;
4021
end
4122

dataset_code-complete-iccad2023/Prob082_lfsr32_prompt.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
A linear feedback shift register is a shift register usually with a few
33
XOR gates to produce the next state of the shift register. A Galois LFSR
4-
is one particular arrangement where bit positions with a "tap" are XORed
5-
with the output bit to produce each bit's next value, while bit positions
6-
without a tap shift. Build a 32-bit Galois LFSR with taps at bit
7-
positions 32, 22, 2, and 1. Reset should be active high synchronous, and
8-
should reset the output q to 32'h1.
4+
is one particular arrangement that shifts right, where a bit position with
5+
a "tap" is XORed with the LSB output bit (q[0]) to produce its next value,
6+
while bit positions without a tap shift right unchanged. Build a 32-bit Galois
7+
LFSR with taps at bit positions 32, 22, 2, and 1. Reset should be active high
8+
synchronous, and should reset the output q to 32'h1.
99

1010
module TopModule (
1111
input clk,

dataset_code-complete-iccad2023/Prob086_lfsr5_prompt.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
A linear feedback shift register is a shift register usually with a few
33
XOR gates to produce the next state of the shift register. A Galois LFSR
4-
is one particular arrangement where bit positions with a "tap" are XORed
5-
with the output bit to produce its next value, while bit positions
6-
without a tap shift. If the taps positions are carefully chosen, the LFSR
7-
can be made to be "maximum-length". A maximum-length LFSR of n bits
8-
cycles through 2**n-1 states before repeating (the all-zero state is
4+
is one particular arrangement that shifts right, where a bit position with
5+
a "tap" is XORed with the LSB output bit (q[0]) to produce its next value,
6+
while bit positions without a tap shift right unchanged. If the taps positions
7+
are carefully chosen, the LFSR can be made to be "maximum-length". A maximum-length
8+
LFSR of n bits cycles through 2**n-1 states before repeating (the all-zero state is
99
never reached). Build a 5-bit maximal-length Galois LFSR with taps at bit
1010
positions 5 and 3. The active-high synchronous reset should reset the
1111
LFSR output to 1.

dataset_code-complete-iccad2023/Prob099_m2014_q6c_test.sv

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,13 @@ module stimulus_gen (
1111
input tb_match
1212
);
1313

14-
int errored1 = 0;
15-
int onehot_error = 0;
16-
int temp;
17-
1814
initial begin
1915
// Test the one-hot cases first.
2016
repeat(200) @(posedge clk, negedge clk) begin
2117
y <= 1<< ($unsigned($random) % 6);
2218
w <= $random;
23-
if (!tb_match) onehot_error++;
24-
end
25-
26-
27-
// Random.
28-
errored1 = 0;
29-
repeat(400) @(posedge clk, negedge clk) begin
30-
do
31-
temp = $random;
32-
while ( !{temp[6:5],temp[3:2]} == !{temp[4],temp[1]} );
33-
// Make y[4,1] and y[6,5,3,2] mutually exclusive, so we can accept Y4=(~y[1] & ~y[4]) &w as a valid answer too.
34-
35-
y[6:1] <= temp[6:1];
36-
w <= $random;
37-
if (!tb_match)
38-
errored1++;
39-
end
40-
if (!onehot_error && errored1)
41-
$display ("Hint: Your circuit passed when given only one-hot inputs, but not with semi-random inputs.");
42-
43-
if (!onehot_error && errored1)
44-
$display("Hint: Are you doing something more complicated than deriving state transition equations by inspection?\n");
45-
19+
end
20+
4621
#1 $finish;
4722
end
4823

dataset_code-complete-iccad2023/Prob104_mt2015_muxdff_prompt.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
Consider this Verilog module "full_module":
33

44
module full_module (
5-
input [2:0] r,
6-
input L,
7-
input clk,
8-
output reg [2:0] q
5+
input [2:0] r, // load value
6+
input L, // load
7+
input clk, // clock
8+
output reg [2:0] q // output
99

1010
always @(posedge clk) begin
1111
if (L) begin
@@ -17,9 +17,11 @@ Consider this Verilog module "full_module":
1717

1818
endmodule
1919

20-
You want to create a hierarchical Verilog design where a flipflop and 2-1
21-
multiplexer are in a submodule, and that submodule is instantiated three
22-
times in this code. Create the submodule called "top_module".
20+
Note that q[2:0] is three bits wide, representing three flip-flops that can be
21+
loaded from r when L is asserted. You want to factor full_module into a hierarchical
22+
design, flipflop and 2:1 multiplexer are in a submodule "TopModule", and that submodule
23+
will be instantiated three times in full_module code. Create the submodule called "TopModule".
24+
You do not have to provide the revised full_module.
2325

2426
module TopModule (
2527
input clk,

dataset_code-complete-iccad2023/Prob124_rule110_prompt.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ array of cells (on or off). At each time step, the state of each cell
55
changes. In Rule 110, the next state of each cell depends only on itself
66
and its two neighbours, according to the following table:
77

8-
Left | Center | Right | Center's next state
9-
1 | 1 | 1 | 0
10-
1 | 1 | 0 | 1
11-
1 | 0 | 1 | 1
12-
1 | 0 | 0 | 0
13-
0 | 1 | 1 | 1
14-
0 | 1 | 0 | 1
15-
0 | 0 | 1 | 1
16-
0 | 0 | 0 | 0
8+
Left[i+1] | Center[i] | Right[i-1] | Center's next state
9+
1 | 1 | 1 | 0
10+
1 | 1 | 0 | 1
11+
1 | 0 | 1 | 1
12+
1 | 0 | 0 | 0
13+
0 | 1 | 1 | 1
14+
0 | 1 | 0 | 1
15+
0 | 0 | 1 | 1
16+
0 | 0 | 0 | 0
1717

1818
In this circuit, create a 512-cell system (q[511:0]), and advance by one
1919
time step each clock cycle. The synchronous active high load input
2020
indicates the state of the system should be loaded with data[511:0].
21-
Assume the boundaries (q[-1] and q[512]) are both zero (off).
21+
Assume the boundaries (q[-1] and q[512], if they existed) are both zero (off).
2222

2323
module TopModule (
2424
input clk,

dataset_code-complete-iccad2023/Prob134_2014_q3c_prompt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Given the state-assigned table shown below, implement the logic functions
33
Y[0] and z.
44

5-
Present state y[2:0] | Next state Y[2:0] x=0, Next state Y[2:0] x=1 | Output z
5+
Present state input y[2:0] | Next state Y[2:0] when x=0, Next state Y[2:0] when x=1 | Output z
66
000 | 000, 001 | 0
77
001 | 001, 100 | 0
88
010 | 010, 001 | 0

dataset_code-complete-iccad2023/Prob143_fsm_onehot_test.sv

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ module stimulus_gen (
2626
#1;
2727
endtask
2828

29-
30-
31-
int errored1 = 0;
32-
int errored2 = 0;
33-
int onehot_error = 0;
3429
reg [9:0] state_error = 10'h0;
3530

3631
initial begin
@@ -59,35 +54,8 @@ module stimulus_gen (
5954
repeat(200) @(posedge clk, negedge clk) begin
6055
state <= 1<< ($unsigned($random) % 10);
6156
in <= $random;
62-
if (!tb_match) onehot_error++;
63-
end
64-
65-
// Two-hot.
66-
errored1 = 0;
67-
repeat(400) @(posedge clk, negedge clk) begin
68-
state <= (1<< ($unsigned($random) % 10)) | (1<< ($unsigned($random) % 10));
69-
in <= $random;
70-
if (!tb_match)
71-
errored1++;
7257
end
7358

74-
if (!onehot_error && errored1)
75-
$display ("Hint: Your circuit passed when given only one-hot inputs, but not with two-hot inputs.");
76-
77-
// Random.
78-
errored2 = 0;
79-
repeat(800) @(posedge clk, negedge clk) begin
80-
state <= $random;
81-
in <= $random;
82-
if (!tb_match)
83-
errored2++;
84-
end
85-
if (!onehot_error && errored2)
86-
$display ("Hint: Your circuit passed when given only one-hot inputs, but not with random inputs.");
87-
88-
if (!onehot_error && (errored1 || errored2))
89-
$display("Hint: Are you doing something more complicated than deriving state transition equations by inspection?\n");
90-
9159
for (int i=0;i<$bits(state_error);i++)
9260
$display("Hint: next_state[%0d] is %s.", i, (state_error[i] === 1'b0) ? "correct": "incorrect");
9361

dataset_code-complete-iccad2023/Prob145_circuit8_prompt.txt

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,46 @@
22
This is a sequential circuit. Read the simulation waveforms to determine
33
what the circuit does, then implement it.
44

5-
time clk a p q
6-
0ns 0 0 x x
7-
5ns 0 0 x x
8-
10ns 0 0 x x
9-
15ns 0 0 x x
10-
20ns 0 0 x x
11-
25ns 1 0 0 x
12-
30ns 1 0 0 x
13-
35ns 1 0 0 x
14-
40ns 1 0 0 x
15-
45ns 1 0 0 x
16-
50ns 1 0 0 x
17-
55ns 0 0 0 0
18-
60ns 0 0 0 0
19-
65ns 0 0 0 0
20-
70ns 0 1 0 0
21-
75ns 0 0 0 0
22-
80ns 0 1 0 0
23-
85ns 1 0 0 0
24-
90ns 1 1 1 0
25-
95ns 1 0 0 0
26-
100ns 1 1 1 0
27-
105ns 1 0 0 0
28-
110ns 1 1 1 0
29-
115ns 0 0 1 1
30-
120ns 0 1 1 1
31-
125ns 0 0 1 1
32-
130ns 0 1 1 1
33-
135ns 0 0 1 1
34-
140ns 0 0 1 1
35-
145ns 1 0 0 1
36-
150ns 1 0 0 1
37-
155ns 1 0 0 1
38-
160ns 1 0 0 1
39-
165ns 1 1 1 1
40-
170ns 1 0 0 1
41-
175ns 0 1 0 0
42-
180ns 0 0 0 0
43-
185ns 0 1 0 0
44-
190ns 0 0 0 0
5+
time clock a p q
6+
0ns 0 0 x x
7+
5ns 0 0 x x
8+
10ns 0 0 x x
9+
15ns 0 0 x x
10+
20ns 0 0 x x
11+
25ns 1 0 0 x
12+
30ns 1 0 0 x
13+
35ns 1 0 0 x
14+
40ns 1 0 0 x
15+
45ns 1 0 0 x
16+
50ns 1 0 0 x
17+
55ns 0 0 0 0
18+
60ns 0 0 0 0
19+
65ns 0 0 0 0
20+
70ns 0 1 0 0
21+
75ns 0 0 0 0
22+
80ns 0 1 0 0
23+
85ns 1 0 0 0
24+
90ns 1 1 1 0
25+
95ns 1 0 0 0
26+
100ns 1 1 1 0
27+
105ns 1 0 0 0
28+
110ns 1 1 1 0
29+
115ns 0 0 1 1
30+
120ns 0 1 1 1
31+
125ns 0 0 1 1
32+
130ns 0 1 1 1
33+
135ns 0 0 1 1
34+
140ns 0 0 1 1
35+
145ns 1 0 0 1
36+
150ns 1 0 0 1
37+
155ns 1 0 0 1
38+
160ns 1 0 0 1
39+
165ns 1 1 1 1
40+
170ns 1 0 0 1
41+
175ns 0 1 0 0
42+
180ns 0 0 0 0
43+
185ns 0 1 0 0
44+
190ns 0 0 0 0
4545

4646
module TopModule (
4747
input clock,

dataset_code-complete-iccad2023/Prob150_review2015_fsmonehot_prompt.txt

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ Given the following Moore state machine with 3 input (d, done_counting,
33
ack) and 3 outputs (shift_ena, counting, done). Unless otherwise stated in
44
the diagram below, assume outputs are 0 and inputs are don't cares.
55

6-
S () --d=0--> S
7-
S () --d=1--> S1
8-
S1 () --d=0--> S
9-
S1 () --d=1--> S11
10-
S11 () --d=0--> S110
11-
S11 () --d=1--> S11
12-
S110 () --d=0--> S
13-
S110 () --d=1--> B0
14-
B0 (shift_ena=1) -- (always go to next cycle) --> B1
15-
B1 (shift_ena=1) -- (always go to next cycle) --> B2
16-
B2 (shift_ena=1) -- (always go to next cycle) --> B3
17-
B3 (shift_ena=1) -- (always go to next cycle) --> Count
18-
Count (counting=1) --!(done_counting)--> Count
19-
Count (counting=1) --(done_counting)--> Wait
20-
Wait (done=1) --ack=0--> Wait
21-
Wait (done=1) --ack=1--> S
6+
state (output) --input--> next state
7+
-------------------------------------------
8+
S () --d=0--> S
9+
S () --d=1--> S1
10+
S1 () --d=0--> S
11+
S1 () --d=1--> S11
12+
S11 () --d=0--> S110
13+
S11 () --d=1--> S11
14+
S110 () --d=0--> S
15+
S110 () --d=1--> B0
16+
B0 (shift_ena=1) --(always go to next cycle)--> B1
17+
B1 (shift_ena=1) --(always go to next cycle)--> B2
18+
B2 (shift_ena=1) --(always go to next cycle)--> B3
19+
B3 (shift_ena=1) --(always go to next cycle)--> Count
20+
Count (counting=1) --done_counting=0--> Count
21+
Count (counting=1) --done_counting=1--> Wait
22+
Wait (done=1) --ack=0--> Wait
23+
Wait (done=1) --ack=1--> S
2224

2325
At reset, the state machine starts in state "S". Derive next-state logic
2426
equations and output logic equations by inspection assuming the following
@@ -29,16 +31,16 @@ Derive state transition and output logic equations by inspection assuming
2931
a one-hot encoding. Implement only the state transition logic and output
3032
logic (the combinational logic portion) for this state machine.
3133

32-
Write code that generates the following equations:
34+
Write code that generates the following signals:
3335

34-
- B3_next -- next-state logic for state B3
35-
- S_next
36-
- S1_next
37-
- Count_next
38-
- Wait_next
39-
- done -- output logic
40-
- counting
41-
- shift_ena
36+
- B3_next -- Assert when next-state is B3 state
37+
- S_next -- Assert when next-state is S state
38+
- S1_next -- Assert when next-state is S1 state
39+
- Count_next -- Assert when next-state is Count state
40+
- Wait_next -- Assert when next-state is Wait state
41+
- done -- output logic
42+
- counting -- output logic
43+
- shift_ena -- output logic
4244

4345
module TopModule (
4446
input d,

0 commit comments

Comments
 (0)