SpecRead / t4_controls_v2.jsonl
EDGAhab's picture
Release SpecRead v2.1 dataset
27d9c70 verified
Raw History Blame Contribute Delete
113 kB
{"id": "uart-t4-001c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/uart/rtl/uart_tx.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "The TX/RX serial lines are high when idle.", "rtl_excerpt": " input logic parity_enable,\n\n input wr,\n input logic wr_parity,\n input [7:0] wr_data,\n output idle,\n\n output logic tx\n);\n\n\n logic [3:0] baud_div_q;\n logic tick_baud_q;\n\n logic [3:0] bit_cnt_q, bit_cnt_d;\n logic [10:0] sreg_q, sreg_d;\n logic tx_q, tx_d;\n\n assign tx = tx_q;\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n baud_div_q <= 4'h0;\n tick_baud_q <= 1'b0;\n end else if (tick_baud_x16) begin\n {tick_baud_q, baud_div_q} <= {1'b0,baud_div_q} + 5'h1;\n end else begin\n tick_baud_q <= 1'b0;\n end\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n bit_cnt_q <= 4'h0;\n sreg_q <= 11'h7ff;\n tx_q <= 1'b1;\n end else begin\n bit_cnt_q <= bit_cnt_d;\n sreg_q <= sreg_d;\n tx_q <= tx_d;\n end\n end\n\n always_comb begin\n if (!tx_enable) begin\n bit_cnt_d = 4'h0;\n sreg_d = 11'h7ff;\n tx_d = 1'b1;\n end else begin\n bit_cnt_d = bit_cnt_q;\n sreg_d = sreg_q;\n tx_d = tx_q;\n if (wr) begin\n sreg_d = {1'b1, (parity_enable ? wr_parity : 1'b1), wr_data, 1'b0};\n bit_cnt_d = (parity_enable ? 4'd11 : 4'd10);\n end else if (tick_baud_q && (bit_cnt_q != 4'h0)) begin\n sreg_d = {1'b1, sreg_q[10:1]};\n tx_d = sreg_q[0];\n bit_cnt_d = bit_cnt_q - 4'h1;\n end\n end\n end\n\n assign idle = (tx_enable) ? (bit_cnt_q == 4'h0) : 1'b1;\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The TX/RX serial lines are high when idle.", "category": null, "rtl_location": "hw/ip/uart/rtl/uart_tx.sv:49", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (tx_q <= 1'b1;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed uart_tx.sv:49; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "uart-t4-001"}
{"id": "uart-t4-003c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/uart/rtl/uart_tx.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "If TX is not enabled, written DATA into FIFO will be stacked up and sent out when TX is enabled.", "rtl_excerpt": "\n\n logic [3:0] baud_div_q;\n logic tick_baud_q;\n\n logic [3:0] bit_cnt_q, bit_cnt_d;\n logic [10:0] sreg_q, sreg_d;\n logic tx_q, tx_d;\n\n assign tx = tx_q;\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n baud_div_q <= 4'h0;\n tick_baud_q <= 1'b0;\n end else if (tick_baud_x16) begin\n {tick_baud_q, baud_div_q} <= {1'b0,baud_div_q} + 5'h1;\n end else begin\n tick_baud_q <= 1'b0;\n end\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n bit_cnt_q <= 4'h0;\n sreg_q <= 11'h7ff;\n tx_q <= 1'b1;\n end else begin\n bit_cnt_q <= bit_cnt_d;\n sreg_q <= sreg_d;\n tx_q <= tx_d;\n end\n end\n\n always_comb begin\n if (!tx_enable) begin\n bit_cnt_d = 4'h0;\n sreg_d = 11'h7ff;\n tx_d = 1'b1;\n end else begin\n bit_cnt_d = bit_cnt_q;\n sreg_d = sreg_q;\n tx_d = tx_q;\n if (wr) begin\n sreg_d = {1'b1, (parity_enable ? wr_parity : 1'b1), wr_data, 1'b0};\n bit_cnt_d = (parity_enable ? 4'd11 : 4'd10);\n end else if (tick_baud_q && (bit_cnt_q != 4'h0)) begin\n sreg_d = {1'b1, sreg_q[10:1]};\n tx_d = sreg_q[0];\n bit_cnt_d = bit_cnt_q - 4'h1;\n end\n end\n end\n\n assign idle = (tx_enable) ? (bit_cnt_q == 4'h0) : 1'b1;\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "If TX is not enabled, written DATA into FIFO will be stacked up and sent out when TX is enabled.", "category": null, "rtl_location": "hw/ip/uart/rtl/uart_tx.sv:58", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (if (!tx_enable) begin). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed uart_tx.sv:58; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "uart-t4-003"}
{"id": "uart-t4-007c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/uart/rtl/uart_rx.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "When the input is detected low the receiver will check half a bit-time later (i.e. 8 cycles of the oversample clock) that the line is still low before detecting the START bit.\nIf the line has returned high the glitch is ignored.", "rtl_excerpt": " sreg_q <= 11'h0;\n bit_cnt_q <= 4'h0;\n baud_div_q <= 4'h0;\n tick_baud_q <= 1'b0;\n idle_q <= 1'b1;\n end else begin\n sreg_q <= sreg_d;\n bit_cnt_q <= bit_cnt_d;\n baud_div_q <= baud_div_d;\n tick_baud_q <= tick_baud_d;\n idle_q <= idle_d;\n end\n end\n\n always_comb begin\n if (!rx_enable) begin\n sreg_d = 11'h0;\n bit_cnt_d = 4'h0;\n baud_div_d = 4'h0;\n tick_baud_d = 1'b0;\n idle_d = 1'b1;\n end else begin\n tick_baud_d = 1'b0;\n sreg_d = sreg_q;\n bit_cnt_d = bit_cnt_q;\n baud_div_d = baud_div_q;\n idle_d = idle_q;\n if (tick_baud_x16) begin\n {tick_baud_d, baud_div_d} = {1'b0,baud_div_q} + 5'h1;\n end\n\n if (idle_q && !rx) begin\n // start of char, sample in the middle of the bit time\n baud_div_d = 4'd8;\n tick_baud_d = 1'b0;\n bit_cnt_d = (parity_enable ? 4'd11 : 4'd10);\n sreg_d = 11'h0;\n idle_d = 1'b0;\n end else if (!idle_q && tick_baud_q) begin\n if ((bit_cnt_q == (parity_enable ? 4'd11 : 4'd10)) && rx) begin\n // must have been a glitch on the input, start bit is not set\n // in the middle of the bit time, abort\n idle_d = 1'b1;\n bit_cnt_d = 4'h0;\n end else begin\n sreg_d = {rx, sreg_q[10:1]};\n bit_cnt_d = bit_cnt_q - 4'h1;\n idle_d = (bit_cnt_q == 4'h1);\n end\n end\n end\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) rx_valid_q <= 1'b0;\n else rx_valid_q <= tick_baud_q & (bit_cnt_q == 4'h1);\n\n end\n\n assign rx_valid = rx_valid_q;\n assign rx_data = parity_enable ? sreg_q[8:1] : sreg_q[9:2];\n // (rx_parity = sreg_q[9])\n assign frame_err = rx_valid_q & ~sreg_q[10];\n assign rx_parity_err = parity_enable & rx_valid_q &\n (^{sreg_q[9:1],parity_odd});\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "When the input is detected low the receiver will check half a bit-time later (i.e. 8 cycles of the oversample clock) that the line is still low before detecting the START bit.\nIf the line has returned high the glitch is ignored.", "category": null, "rtl_location": "hw/ip/uart/rtl/uart_rx.sv:74", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (bit_cnt_d = (parity_enable ? 4'd11 : 4'd10);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed uart_rx.sv:74; excerpt widened to +/-35 lines per fairness audit", "difficulty": "hard", "paired_violation": "uart-t4-007"}
{"id": "uart-t4-010c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/uart/rtl/uart_rx.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "The least significant bit is sent first.", "rtl_excerpt": " baud_div_d = baud_div_q;\n idle_d = idle_q;\n if (tick_baud_x16) begin\n {tick_baud_d, baud_div_d} = {1'b0,baud_div_q} + 5'h1;\n end\n\n if (idle_q && !rx) begin\n // start of char, sample in the middle of the bit time\n baud_div_d = 4'd8;\n tick_baud_d = 1'b0;\n bit_cnt_d = (parity_enable ? 4'd11 : 4'd10);\n sreg_d = 11'h0;\n idle_d = 1'b0;\n end else if (!idle_q && tick_baud_q) begin\n if ((bit_cnt_q == (parity_enable ? 4'd11 : 4'd10)) && rx) begin\n // must have been a glitch on the input, start bit is not set\n // in the middle of the bit time, abort\n idle_d = 1'b1;\n bit_cnt_d = 4'h0;\n end else begin\n sreg_d = {rx, sreg_q[10:1]};\n bit_cnt_d = bit_cnt_q - 4'h1;\n idle_d = (bit_cnt_q == 4'h1);\n end\n end\n end\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) rx_valid_q <= 1'b0;\n else rx_valid_q <= tick_baud_q & (bit_cnt_q == 4'h1);\n\n end\n\n assign rx_valid = rx_valid_q;\n assign rx_data = parity_enable ? sreg_q[8:1] : sreg_q[9:2];\n // (rx_parity = sreg_q[9])\n assign frame_err = rx_valid_q & ~sreg_q[10];\n assign rx_parity_err = parity_enable & rx_valid_q &\n (^{sreg_q[9:1],parity_odd});\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The least significant bit is sent first.", "category": null, "rtl_location": "hw/ip/uart/rtl/uart_rx.sv:99", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign rx_data = parity_enable ? sreg_q[8:1] : sreg_q[9:2];). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed uart_rx.sv:99; excerpt widened to +/-35 lines per fairness audit", "difficulty": "hard", "paired_violation": "uart-t4-010"}
{"id": "aes-t4-001c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n//\n// AES ShiftRows\n\nmodule aes_shift_rows (\n input aes_pkg::ciph_op_e op_i,\n input logic [3:0][3:0][7:0] data_i,\n output logic [3:0][3:0][7:0] data_o\n);\n\n import aes_pkg::*;\n\n // Row 0 is left untouched\n assign data_o[0] = data_i[0];\n\n // Row 2 does not depend on op_i\n assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n\n // Row 1\n assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[1], 2'h1) :\n aes_circ_byte_shift(data_i[1], 2'h3);\n\n // Row 3\n assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[3], 2'h3) :\n aes_circ_byte_shift(data_i[3], 2'h1);\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:22", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:22; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "aes-t4-001"}
{"id": "aes-t4-003c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n//\n// AES ShiftRows\n\nmodule aes_shift_rows (\n input aes_pkg::ciph_op_e op_i,\n input logic [3:0][3:0][7:0] data_i,\n output logic [3:0][3:0][7:0] data_o\n);\n\n import aes_pkg::*;\n\n // Row 0 is left untouched\n assign data_o[0] = data_i[0];\n\n // Row 2 does not depend on op_i\n assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n\n // Row 1\n assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[1], 2'h1) :\n aes_circ_byte_shift(data_i[1], 2'h3);\n\n // Row 3\n assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[3], 2'h3) :\n aes_circ_byte_shift(data_i[3], 2'h1);\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:27", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:27; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "aes-t4-003"}
{"id": "aes-t4-004c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n//\n// AES ShiftRows\n\nmodule aes_shift_rows (\n input aes_pkg::ciph_op_e op_i,\n input logic [3:0][3:0][7:0] data_i,\n output logic [3:0][3:0][7:0] data_o\n);\n\n import aes_pkg::*;\n\n // Row 0 is left untouched\n assign data_o[0] = data_i[0];\n\n // Row 2 does not depend on op_i\n assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n\n // Row 1\n assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[1], 2'h1) :\n aes_circ_byte_shift(data_i[1], 2'h3);\n\n // Row 3\n assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[3], 2'h3) :\n aes_circ_byte_shift(data_i[3], 2'h1);\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:28", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly ((op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[3], 2'h3) :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:28; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "aes-t4-004"}
{"id": "aes-t4-006c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n//\n// AES ShiftRows\n\nmodule aes_shift_rows (\n input aes_pkg::ciph_op_e op_i,\n input logic [3:0][3:0][7:0] data_i,\n output logic [3:0][3:0][7:0] data_o\n);\n\n import aes_pkg::*;\n\n // Row 0 is left untouched\n assign data_o[0] = data_i[0];\n\n // Row 2 does not depend on op_i\n assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n\n // Row 1\n assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[1], 2'h1) :\n aes_circ_byte_shift(data_i[1], 2'h3);\n\n // Row 3\n assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[3], 2'h3) :\n aes_circ_byte_shift(data_i[3], 2'h1);\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:24", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (aes_circ_byte_shift(data_i[1], 2'h3);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:24; excerpt widened to +/-35 lines per fairness audit", "difficulty": "hard", "paired_violation": "aes-t4-006"}
{"id": "aes-t4-012c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n//\n// AES ShiftRows\n\nmodule aes_shift_rows (\n input aes_pkg::ciph_op_e op_i,\n input logic [3:0][3:0][7:0] data_i,\n output logic [3:0][3:0][7:0] data_o\n);\n\n import aes_pkg::*;\n\n // Row 0 is left untouched\n assign data_o[0] = data_i[0];\n\n // Row 2 does not depend on op_i\n assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n\n // Row 1\n assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[1], 2'h1) :\n aes_circ_byte_shift(data_i[1], 2'h3);\n\n // Row 3\n assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :\n (op_i == CIPH_INV) ? aes_circ_byte_shift(data_i[3], 2'h3) :\n aes_circ_byte_shift(data_i[3], 2'h1);\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. (For the exact offsets the OpenTitan documentation refers to the AES specification, FIPS-197 section 5.1.2: during encryption row r is cyclically shifted left by r bytes -- row 0 by 0, row 1 by 1, row 2 by 2, row 3 by 3 -- and during decryption row r is shifted right by r bytes. The original RTL implements exactly this: it was verified against a corrected FIPS-197 reference model with ORIG_MODEL_ERRORS=0.)", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:27", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1) :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:27; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "aes-t4-012"}
{"id": "aes-t4-015c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. Each output row is therefore computed from the same input row (rows are shifted, never permuted), and row 0 is left untouched.", "rtl_excerpt": "16: assign data_o[0] = data_i[0];\n17: \n18: // Row 2 does not depend on op_i\n19: assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n20: \n21: // Row 1\n22: assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. Each output row is therefore computed from the same input row (rows are shifted, never permuted), and row 0 is left untouched.", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:19", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:19", "difficulty": "medium", "paired_violation": "aes-t4-015"}
{"id": "aes-t4-018c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aes/rtl/aes_shift_rows.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. Each output row is therefore computed from the same input row (rows are shifted, never permuted), and row 0 is left untouched.", "rtl_excerpt": "16: assign data_o[0] = data_i[0];\n17: \n18: // Row 2 does not depend on op_i\n19: assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);\n20: \n21: // Row 1\n22: assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3) :", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "ShiftRows Transformation: The bytes of the last three rows of the state are cyclically shifted over different offsets. Each output row is therefore computed from the same input row (rows are shifted, never permuted), and row 0 is left untouched.", "category": null, "rtl_location": "hw/ip/aes/rtl/aes_shift_rows.sv:19", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aes_shift_rows.sv:19", "difficulty": "medium", "paired_violation": "aes-t4-018"}
{"id": "aon_timer-t4-001c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aon_timer/rtl/aon_timer_core.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "## WKUP_CTRL\nWakeup Timer Control register.\nEach write to the register resets the internal prescaler count.", "rtl_excerpt": "47: if (!rst_aon_ni) begin\n48: prescale_count_q <= 12'h000;\n49: end else if (reg2hw_i.wkup_ctrl.prescaler.qe) begin\n50: prescale_count_q <= 12'h000;\n51: end else if (prescale_en) begin\n52: prescale_count_q <= prescale_count_d;\n53: end", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "Each write to the WKUP_CTRL register resets the internal prescaler count.", "category": null, "rtl_location": "hw/ip/aon_timer/rtl/aon_timer_core.sv:51", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (prescale_count_q <= 12'h000;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aon_timer_core.sv (original at line [48, 50])", "difficulty": "medium", "paired_violation": "aon_timer-t4-001"}
{"id": "aon_timer-t4-005c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aon_timer/rtl/aon_timer_core.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "## WDOG_CTRL\nWatchdog Timer Control register\n| 1 | rw | 0x0 | pause_in_sleep | When set to 1, the watchdog timer will not count during sleep. |\n| 0 | rw | 0x0 | enable | When set to 1, the watchdog timer will count. |", "rtl_excerpt": "74: // Watchdog timer count\n75: assign wdog_incr = reg2hw_i.wdog_ctrl.enable.q &\n76: lc_ctrl_pkg::lc_tx_test_false_strict(lc_escalate_en_i[2]) &\n77: ~(sleep_mode_i & reg2hw_i.wdog_ctrl.pause_in_sleep.q);\n78: \n79: assign wdog_count_reg_wr_o = wdog_incr;\n80: assign wdog_count_wr_data_o = (reg2hw_i.wdog_count.q + 32'd1);", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "When WDOG_CTRL.pause_in_sleep is set to 1, the watchdog timer will not count during sleep.", "category": null, "rtl_location": "hw/ip/aon_timer/rtl/aon_timer_core.sv:77", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (~(sleep_mode_i & reg2hw_i.wdog_ctrl.pause_in_sleep.q);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aon_timer_core.sv:77", "difficulty": "medium", "paired_violation": "aon_timer-t4-005"}
{"id": "aon_timer-t4-008c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/aon_timer/rtl/aon_timer_core.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "If either timer reaches the programmed threshold, interrupts are generated from the AON_TIMER module.\n## WDOG_BITE_THOLD\nWatchdog Timer Bite Threshold Register\n| 31:0 | rw | 0x0 | threshold | The count at which a watchdog bite reset should be generated. |", "rtl_excerpt": " prescale_count_q <= 12'h000;\n end else if (prescale_en) begin\n prescale_count_q <= prescale_count_d;\n end\n end\n\n assign wkup_count = {reg2hw_i.wkup_count_hi.q, reg2hw_i.wkup_count_lo.q};\n assign wkup_thold = {reg2hw_i.wkup_thold_hi.q, reg2hw_i.wkup_thold_lo.q};\n\n // Wakeup timer count\n assign wkup_incr = lc_ctrl_pkg::lc_tx_test_false_strict(lc_escalate_en_i[1]) &\n reg2hw_i.wkup_ctrl.enable.q &\n (prescale_count_q == reg2hw_i.wkup_ctrl.prescaler.q);\n\n assign wkup_count_reg_wr_o = wkup_incr;\n assign wkup_count_wr_data_o = wkup_count + 64'd1;\n\n // Timer interrupt\n assign wkup_intr_o = wkup_incr & (wkup_count >= wkup_thold);\n\n ////////////////////\n // Watchdog Timer //\n ////////////////////\n\n // Watchdog timer count\n assign wdog_incr = reg2hw_i.wdog_ctrl.enable.q &\n lc_ctrl_pkg::lc_tx_test_false_strict(lc_escalate_en_i[2]) &\n ~(sleep_mode_i & reg2hw_i.wdog_ctrl.pause_in_sleep.q);\n\n assign wdog_count_reg_wr_o = wdog_incr;\n assign wdog_count_wr_data_o = (reg2hw_i.wdog_count.q + 32'd1);\n\n // Timer interrupt\n assign wdog_intr_o = wdog_incr & (reg2hw_i.wdog_count.q >= reg2hw_i.wdog_bark_thold.q);\n // Timer reset\n assign wdog_reset_req_o = wdog_incr & (reg2hw_i.wdog_count.q >= reg2hw_i.wdog_bite_thold.q);\n\n assign unused_reg2hw = |{reg2hw_i.intr_state, reg2hw_i.intr_test, reg2hw_i.wkup_cause,\n reg2hw_i.alert_test};\n\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "If either timer reaches the programmed threshold, the event is generated; the watchdog bite reset is generated at the count in WDOG_BITE_THOLD.", "category": null, "rtl_location": "hw/ip/aon_timer/rtl/aon_timer_core.sv:85", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign wdog_reset_req_o = wdog_incr & (reg2hw_i.wdog_count.q >= reg2hw_i.wdog_bite_thold.q);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed aon_timer_core.sv:85; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "aon_timer-t4-008"}
{"id": "i2c-t4-001c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_bus_monitor.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "At initial attachment in a multi-controller environment, typically the controller needs to wait until it determines the bus is free, and the initial state should be assumed to be busy. To make this happen, HOST_TIMEOUT_CTRL should be programmed before enabling the bus monitor in CTRL.", "rtl_excerpt": "// detection.\n\nmodule i2c_bus_monitor import i2c_pkg::*;\n(\n input clk_i,\n input rst_ni,\n\n input scl_i,\n input sda_i,\n\n input controller_enable_i,\n input multi_controller_enable_i,\n input target_enable_i,\n input target_idle_i,\n input [12:0] thd_dat_i, // Data hold time(< 200 ns, < thd_sta)\n input [12:0] t_buf_i, // Bus free time (< 5 us)\n input [29:0] bus_active_timeout_i, // SCL held low (~25 ms)\n input bus_active_timeout_en_i,\n input [19:0] bus_inactive_timeout_i, // SCL held high (~50 us)\n\n output logic bus_free_o,\n output start_detect_o,\n output stop_detect_o,\n\n output event_bus_active_timeout_o,\n output event_host_timeout_o\n\n);\n\n // Only activate this monitor if at least one of the modules is enabled.\n logic monitor_enable, monitor_enable_q;\n assign monitor_enable = controller_enable_i | target_enable_i | multi_controller_enable_i;\n\n always_ff @ (posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n monitor_enable_q <= 1'b0;\n end else begin\n monitor_enable_q <= monitor_enable;\n end\n end\n\n // SDA and SCL at the previous clock edge\n logic scl_i_q, sda_i_q;\n always_ff @ (posedge clk_i or negedge rst_ni) begin : bus_prev\n if (!rst_ni) begin\n scl_i_q <= 1'b1;\n sda_i_q <= 1'b1;\n end else begin\n scl_i_q <= scl_i;\n sda_i_q <= sda_i;\n end\n end\n\n // Start and Stop detection\n //\n // To resolve ambiguity with early SDA arrival, reject control symbols when\n // SCL goes low too soon. The hold time for ordinary data/ACK bits is too\n // short to reliably see SCL change before SDA. Use the hold time for\n // control signals to ensure a Start or Stop symbol was actually received.\n // Requirements: thd_dat + 1 < thd_sta\n // The extra (+1) here is to account for a late SDA arrival due to CDC\n // skew.\n //\n // Note that this counter combines Start and Stop detection into one\n // counter. A controller-only reset scenario could end up with a Stop\n // following shortly after a Start, with the requisite setup time not\n // observed.\n logic start_det_trigger, start_det_pending;\n logic start_det; // indicates start or repeated start is detected on the bus\n logic stop_det_trigger, stop_det_pending;\n logic stop_det; // indicates stop is detected on the bus", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "At initial attachment in a multi-controller environment, typically the controller needs to wait until it determines the bus is free, and the initial state should be assumed to be busy. To make this happen, HOST_TIMEOUT_CTRL should be programmed before enabling the bus monitor in CTRL.", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_bus_monitor.sv:41", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (monitor_enable_q <= 1'b0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_bus_monitor.sv:41; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "i2c-t4-001"}
{"id": "i2c-t4-003c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_bus_monitor.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "In multi-controller monitor mode the monitor will report that the bus is busy until the free time expires after an external controller issues a STOP condition.", "rtl_excerpt": " state_d = StBusFree;\n end\n end\n\n default: begin\n state_d = StBusFree;\n end\n endcase\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n state_q <= StBusFree;\n end else if (!monitor_enable) begin\n state_q <= StBusFree;\n end else if (monitor_enable && !monitor_enable_q) begin\n if (multi_controller_enable_i) begin\n // For the multi-controller case, wait until the bus isn't busy before\n // transmitting.\n state_q <= StBusBusyHigh;\n end else begin\n state_q <= StBusFree;\n end\n end else begin\n state_q <= state_d;\n end\n end\n\n always_comb begin\n if (multi_controller_enable_i) begin\n bus_free_o = (state_q == StBusFree);\n end else begin\n // For single-controller cases, the bus is only \"busy\" while waiting for the \"bus free\" time\n // after a Stop condition. In other words, that is the only time our controller can't\n // continue to the next transaction.\n bus_free_o = (state_q != StBusBusyStop);\n end\n end\n\n assign event_bus_active_timeout_o = bus_active_timeout_det_d && !bus_active_timeout_det_q;\n assign event_host_timeout_o = !target_idle_i && bus_inactive_timeout_det;\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "In multi-controller monitor mode the monitor will report that the bus is busy until the free time expires after an external controller issues a STOP condition.", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_bus_monitor.sv:299", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (bus_free_o = (state_q != StBusBusyStop);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_bus_monitor.sv:299; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "i2c-t4-003"}
{"id": "i2c-t4-006c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_bus_monitor.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "If a controller ceases to send SCL pulses at any point during an ongoing transaction, the target waits for a specified time period and then asserts the interrupt host_timeout. A controller sending an address and R/W bit to all target devices, writing to the selected target, or reading from the target are examples of ongoing transactions.", "rtl_excerpt": "301: end\n302: \n303: assign event_bus_active_timeout_o = bus_active_timeout_det_d && !bus_active_timeout_det_q;\n304: assign event_host_timeout_o = !target_idle_i && bus_inactive_timeout_det;\n305: \n306: endmodule", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "If a controller ceases to send SCL pulses at any point during an ongoing transaction, the target waits for a specified time period and then asserts the interrupt host_timeout. A controller sending an address and R/W bit to all target devices, writing to the selected target, or reading from the target are examples of ongoing transactions.", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_bus_monitor.sv:304", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign event_host_timeout_o = !target_idle_i && bus_inactive_timeout_det;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_bus_monitor.sv:304", "difficulty": "medium", "paired_violation": "i2c-t4-006"}
{"id": "i2c-t4-010c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_bus_monitor.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "t_HD,DAT: set in register TIMING3.THD_DAT. ... when the IP operates as a target, the parameter specifies the required SCL high time after SDA changes to satisfy the Start and Stop symbol decoders.", "rtl_excerpt": "110: \n111: // (Repeated) Start condition detection by target\n112: assign start_det_trigger = monitor_enable && (scl_i_q && scl_i) & (sda_i_q && !sda_i);\n113: assign start_det = monitor_enable && start_det_pending && (ctrl_det_count >= 14'(thd_dat_i));\n114: assign start_detect_o = start_det;\n115: \n116: // Stop condition detection by target", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "t_HD,DAT: set in register TIMING3.THD_DAT. ... when the IP operates as a target, the parameter specifies the required SCL high time after SDA changes to satisfy the Start and Stop symbol decoders.", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_bus_monitor.sv:113", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign start_det = monitor_enable && start_det_pending && (ctrl_det_count >= 14'(thd_dat_i));). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_bus_monitor.sv:113", "difficulty": "hard", "paired_violation": "i2c-t4-010"}
{"id": "i2c-t4-011c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_controller_fsm.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "The I2C Control Module reads each format indicator from the head of FMT_FIFO and processes them in turn. ... the I2C FSM simply transmits the format byte onto the SCL and SDA pins according to the specification, waits for acknowledgement, and then proceeds to the next format indicator. (A byte is 8 bits; the FSM counts bit_index from 7 down to 0.)", "rtl_excerpt": " stretch_predict_cnt_expired <= 1'b0;\n end else begin\n if (stretch_idle_cnt == stretch_cnt_threshold) begin\n stretch_predict_cnt_expired <= 1'b1;\n end else if (!stretch_en) begin\n stretch_predict_cnt_expired <= 1'b0;\n end\n end\n end\n\n // While the FSM is halted due to an unhandled 'nak' irq in Host-Mode, this counter can\n // be used to trigger a timeout which disables Host-Mode and creates a STOP condition to\n // end the transaction.\n logic unhandled_nak_cnt_expired;\n always_ff @ (posedge clk_i or negedge rst_ni) begin : unhandled_nak_cnt_b\n if (!rst_ni) begin\n unhandled_nak_cnt <= '0;\n unhandled_nak_cnt_expired <= 1'b0;\n end else if (incr_nak_cnt) begin\n // Increment the counter while the FSM is halted in Idle.\n unhandled_nak_cnt <= unhandled_nak_cnt + 1'b1;\n if (unhandled_nak_cnt > host_nack_handler_timeout_i) begin\n unhandled_nak_cnt_expired <= 1'b1;\n end\n end else begin\n unhandled_nak_cnt <= '0;\n unhandled_nak_cnt_expired <= 1'b0;\n end\n end\n\n assign event_unhandled_nak_timeout_o = unhandled_nak_cnt_expired;\n\n // Bit index implementation\n always_ff @ (posedge clk_i or negedge rst_ni) begin : bit_counter\n if (!rst_ni) begin\n bit_index <= 3'd7;\n end else if (bit_clr) begin\n bit_index <= 3'd7;\n end else if (bit_decr) begin\n bit_index <= bit_index - 1'b1;\n end else begin\n bit_index <= bit_index;\n end\n end\n\n // Deserializer for a byte read from the bus\n always_ff @ (posedge clk_i or negedge rst_ni) begin : read_register\n if (!rst_ni) begin\n read_byte <= 8'h00;\n end else if (read_byte_clr) begin\n read_byte <= 8'h00;\n end else if (shift_data_en) begin\n read_byte[7:0] <= {read_byte[6:0], sda_i}; // MSB goes in first\n end\n end\n\n // Number of bytes to read\n always_comb begin : byte_number\n if (!fmt_flag_read_bytes_i) byte_num = 9'd0;\n else if (fmt_byte_i == '0) byte_num = 9'd256;\n else byte_num = 9'(fmt_byte_i);\n end\n\n // Byte index implementation\n always_ff @ (posedge clk_i or negedge rst_ni) begin : byte_counter\n if (!rst_ni) begin\n byte_index <= '0;\n end else if (byte_clr) begin\n byte_index <= byte_num;\n end else if (byte_decr) begin\n byte_index <= byte_index - 1'b1;", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The I2C Control Module reads each format indicator from the head of FMT_FIFO and processes them in turn. ... the I2C FSM simply transmits the format byte onto the SCL and SDA pins according to the specification, waits for acknowledgement, and then proceeds to the next format indicator. (A byte is 8 bits; the FSM counts bit_index from 7 down to 0.)", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_controller_fsm.sv:224", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (bit_index <= 3'd7;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_controller_fsm.sv:224; excerpt widened to +/-35 lines per fairness audit", "difficulty": "easy", "paired_violation": "i2c-t4-011"}
{"id": "i2c-t4-013c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_controller_fsm.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "If the Controller Module transmits a byte and the 9th bit is a NACK from the Target/Bus, the controller_halt interrupt is usually asserted (modulo the effect of FDATA.NAKOK). (A NACK is the 9th bit high, i.e. SDA high; an ACK is SDA low.)", "rtl_excerpt": " end\n scl_d = 1'b0;\n transmitting_o = 1'b1;\n end\n // ClockPulse: SCL is released, SDA keeps the indexed bit value\n ClockPulse : begin\n host_idle_o = 1'b0;\n sda_d = fmt_byte_i[bit_index];\n scl_d = 1'b1;\n transmitting_o = 1'b1;\n stretch_en = 1'b1;\n if (scl_i_q && !scl_i) event_scl_interference_o = 1'b1;\n if (scl_i_q && scl_i && (sda_i_q != sda_i)) begin\n // Unexpected Stop / Start\n event_sda_unstable_o = 1'b1;\n end\n end\n // HoldBit: SCL is pulled low\n HoldBit : begin\n host_idle_o = 1'b0;\n sda_d = fmt_byte_i[bit_index];\n scl_d = 1'b0;\n transmitting_o = 1'b1;\n end\n // ClockLowAck: SCL pulled low, SDA is released\n ClockLowAck : begin\n host_idle_o = 1'b0;\n sda_d = 1'b1;\n scl_d = 1'b0;\n end\n // ClockPulseAck: SCL is released\n ClockPulseAck : begin\n host_idle_o = 1'b0;\n sda_d = 1'b1;\n scl_d = 1'b1;\n if (!scl_i_q && scl_i && sda_i && !fmt_flag_nak_ok_i) event_nak_o = 1'b1;\n stretch_en = 1'b1;\n if (scl_i_q && !scl_i) event_scl_interference_o = 1'b1;\n if (scl_i_q && scl_i && (sda_i_q != sda_i)) begin\n // Unexpected Stop / Start\n event_sda_unstable_o = 1'b1;\n end\n end\n // HoldDevAck: SCL is pulled low\n HoldDevAck : begin\n host_idle_o = 1'b0;\n sda_d = 1'b1;\n scl_d = 1'b0;\n end\n // ReadClockLow: SCL is pulled low, SDA is released\n ReadClockLow : begin\n host_idle_o = 1'b0;\n sda_d = 1'b1;\n scl_d = 1'b0;\n end\n // ReadClockPulse: SCL is released, the indexed bit value is read off SDA\n ReadClockPulse : begin\n host_idle_o = 1'b0;\n scl_d = 1'b1;\n stretch_en = 1'b1;\n if (scl_i_q && !scl_i) event_scl_interference_o = 1'b1;\n if (scl_i_q && scl_i && (sda_i_q != sda_i)) begin\n // Unexpected Stop / Start\n event_sda_unstable_o = 1'b1;\n end\n end\n // ReadHoldBit: SCL is pulled low\n ReadHoldBit : begin\n host_idle_o = 1'b0;\n scl_d = 1'b0;\n if (bit_index == '0 && tcount_q == 16'd1) begin", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "If the Controller Module transmits a byte and the 9th bit is a NACK from the Target/Bus, the controller_halt interrupt is usually asserted (modulo the effect of FDATA.NAKOK). (A NACK is the 9th bit high, i.e. SDA high; an ACK is SDA low.)", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_controller_fsm.sv:456", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (if (!scl_i_q && scl_i && sda_i && !fmt_flag_nak_ok_i) event_nak_o = 1'b1;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_controller_fsm.sv:456; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "i2c-t4-013"}
{"id": "i2c-t4-016c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_controller_fsm.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "t_LOW: set in register TIMING0.TLOW. t_HD,DAT: set in register TIMING3.THD_DAT. ... This parameter controls the number of cycles after the falling edge of SCL that SDA is driven. The SCL low-period counter is loaded with (t_low - t_hd,dat).", "rtl_excerpt": "126: tSetupStart : tcount_d = 16'(t_r_i) + 16'(tsu_sta_i);\n127: tHoldStart : tcount_d = 16'(t_f_i) + 16'(thd_sta_i);\n128: tClockStart : tcount_d = 16'(thd_dat_i);\n129: tClockLow : tcount_d = 16'(tlow_i) - 16'(thd_dat_i);\n130: tClockPulse : tcount_d = 16'(t_r_i) + 16'(thigh_i);\n131: tClockHigh : tcount_d = 16'(thigh_i);\n132: tHoldBit : tcount_d = 16'(t_f_i) + 16'(thd_dat_i);", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "t_LOW: set in register TIMING0.TLOW. t_HD,DAT: set in register TIMING3.THD_DAT. ... This parameter controls the number of cycles after the falling edge of SCL that SDA is driven. The SCL low-period counter is loaded with (t_low - t_hd,dat).", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_controller_fsm.sv:129", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (tClockLow : tcount_d = 16'(tlow_i) - 16'(thd_dat_i);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_controller_fsm.sv:129", "difficulty": "hard", "paired_violation": "i2c-t4-016"}
{"id": "i2c-t4-019c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/i2c/rtl/i2c_controller_fsm.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "READB (corresponds to FDATA.READB): Signifies the format byte (FDATA.FBYTE) should be treated as an unsigned number, R, and prompts the state machine to read R bytes from the target device.", "rtl_excerpt": " bit_clr = 1'b1;\n read_byte_clr = 1'b1;\n end else begin\n state_d = ReadClockLow;\n bit_decr = 1'b1;\n end\n end\n end\n // HostClockLowAck: SCL is pulled low, SDA is conditional based on\n // byte position\n HostClockLowAck : begin\n if (tcount_q == 16'd1) begin\n state_d = HostClockPulseAck;\n load_tcount = 1'b1;\n tcount_sel = tClockPulse;\n end\n end\n // HostClockPulseAck: SCL is released\n HostClockPulseAck : begin\n if (!scl_i && !scl_i_q && stretch_predict_cnt_expired) begin\n // Saw stretching. Remain in this state and don't count down until we see SCL high.\n load_tcount = 1'b1;\n tcount_sel = tClockHigh;\n end else if (scl_i_q && scl_i && (sda_i_q != sda_i)) begin\n // Unexpected Stop / Start\n state_d = Idle;\n end else if (tcount_q == 16'd1 || (!scl_i && scl_i_q)) begin\n state_d = HostHoldBitAck;\n load_tcount = 1'b1;\n tcount_sel = tHoldBit;\n end\n end\n // HostHoldBitAck: SCL is pulled low\n HostHoldBitAck : begin\n if (tcount_q == 16'd1) begin\n if (byte_index == 9'd1) begin\n if (fmt_flag_stop_after_i) begin\n state_d = ClockStop;\n load_tcount = 1'b1;\n tcount_sel = tClockStop;\n end else begin\n state_d = PopFmtFifo;\n load_tcount = 1'b1;\n tcount_sel = tNoDelay;\n end\n end else begin\n state_d = ReadClockLow;\n load_tcount = 1'b1;\n tcount_sel = tClockLow;\n byte_decr = 1'b1;\n end\n end\n end\n // ClockStop: SCL is pulled low, SDA stays low\n ClockStop : begin\n if (tcount_q == 16'd1) begin\n state_d = SetupStop;\n load_tcount = 1'b1;\n tcount_sel = tSetupStop;\n end\n end\n // SetupStop: SDA is pulled low, SCL is released\n SetupStop : begin\n if (!scl_i && !scl_i_q && stretch_predict_cnt_expired) begin\n // Saw stretching. Remain in this state and don't count down until we see SCL high.\n load_tcount = 1'b1;\n tcount_sel = tSetupStop;\n end else if (!scl_i && scl_i_q) begin\n // Failed to issue Stop before some other device could pull SCL low.\n state_d = Idle;\n end else if (tcount_q == 16'd1) begin", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "READB (corresponds to FDATA.READB): Signifies the format byte (FDATA.FBYTE) should be treated as an unsigned number, R, and prompts the state machine to read R bytes from the target device.", "category": null, "rtl_location": "hw/ip/i2c/rtl/i2c_controller_fsm.sv:845", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (if (byte_index == 9'd1) begin). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed i2c_controller_fsm.sv:845; excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "i2c-t4-019"}
{"id": "pattgen-t4-002c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/pattgen/rtl/pattgen_chan.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "The `bit_cnt` counter increments on every falling edge of `pcl_int`, until it returns to zero at the pattern length based on the `len` input.\nNote that since the allowed seed length ranges from 1-64, the value of this field should be one less than the pattern length.", "rtl_excerpt": "121: // - Reset to zero immediately and do not increment when enable is inactive.\n122: assign bit_cnt_en = (pcl_int_q & prediv_clk_rollover) | (~enable);\n123: assign bit_cnt_d = (!enable) ? 6'h0 :\n124: (bit_cnt_q == len_q) ? 6'h0 : // Rollover\n125: bit_cnt_q + 6'h1;\n126: \n127: always_ff @(posedge clk_i or negedge rst_ni) begin", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "bit_cnt returns to zero at the pattern length based on the len input, where len holds the pattern length minus one.", "category": null, "rtl_location": "hw/ip/pattgen/rtl/pattgen_chan.sv:124", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly ((bit_cnt_q == len_q) ? 6'h0 : // Rollover). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed pattgen_chan.sv:124", "difficulty": "medium", "paired_violation": "pattgen-t4-002"}
{"id": "pattgen-t4-003c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/pattgen/rtl/pattgen_chan.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "The FSM clock output, `pcl`, is directly driven by `pcl_int`, unless the `polarity` input is high, in which case `pcl` is inverted from `pcl_int`.", "rtl_excerpt": "73: pcl_o <= 1'b0;\n74: pda_o <= 1'b0;\n75: end else begin\n76: pcl_o <= active ? (polarity_q ? ~pcl_int_q : pcl_int_q)\n77: : inactive_level_pcl_q;\n78: pda_o <= active ? data_q[bit_cnt_q]\n79: : inactive_level_pda_q;", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "pcl is directly driven by pcl_int unless polarity is high, in which case pcl is inverted from pcl_int.", "category": null, "rtl_location": "hw/ip/pattgen/rtl/pattgen_chan.sv:77", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (pcl_o <= active ? (polarity_q ? ~pcl_int_q : pcl_int_q)). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed pattgen_chan.sv (original at line [76])", "difficulty": "medium", "paired_violation": "pattgen-t4-003"}
{"id": "pattgen-t4-005c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "file": "hw/ip/pattgen/rtl/pattgen_chan.sv", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "license": "Apache-2.0"}, "spec_excerpt": "Please note that writes to a channel's configuration registers have no effect while the channel is enabled.\nFor operational simplicity, the configuration registers are only transferred into the internal finite state machines while a channel is disabled.\nChanges to the configuration registers only take effect once the channel has been disabled and re-enabled.", "rtl_excerpt": "57: len_q <= 6'h0;\n58: reps_q <= 10'h0;\n59: end else begin\n60: polarity_q <= enable ? polarity_q : ctrl_i.polarity;\n61: inactive_level_pcl_q <= enable ? inactive_level_pcl_q : ctrl_i.inactive_level_pcl;\n62: inactive_level_pda_q <= enable ? inactive_level_pda_q : ctrl_i.inactive_level_pda;\n63: prediv_q <= enable ? prediv_q : ctrl_i.prediv;", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "Writes to a channel's configuration registers have no effect while the channel is enabled; they only take effect once the channel has been disabled and re-enabled.", "category": null, "rtl_location": "hw/ip/pattgen/rtl/pattgen_chan.sv:60", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (polarity_q <= enable ? polarity_q : ctrl_i.polarity;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed pattgen_chan.sv:60", "difficulty": "medium", "paired_violation": "pattgen-t4-005"}
{"id": "spi_device-t4-001c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spid_csb_sync.sv", "license": "Apache-2.0"}, "spec_excerpt": "Note that the passthrough gate only updates on CSb de-assertion and derives its value from the committed `BUSY` bit.\nThis means that after the `BUSY` bit is set, there must be at least one command before the passthrough gate will open again.", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n\n// spid_csb_sync detects the deassertion edge (positive edge) of CSB for\n// spi_device. With a prim_edge_detector alone, CSB would have pulse width\n// requirements relative to clk_i, and these could be restrictive relative to\n// the downstream SPI flash.\n//\n// Instead, use a CSB-clocked toggle and detect the much slower-changing\n// toggles, making use of CSB's low duty cycle.\n//\n// In addition, this module filters CSB \"cycles\" without SPI clocks.\n// The sck_pulse_en_i input allows further filtering of CSB-triggered pulses.\n// For example, this can be used to trigger a pulse only when there is a new\n// uploaded command.\n\nmodule spid_csb_sync (\n input clk_i,\n input rst_ni,\n input sck_i,\n input sck_pulse_en_i,\n input csb_i,\n output csb_deasserted_pulse_o\n);\n\n logic sck_toggle, csb_toggle, sys_toggle, sys_toggle_last;\n\n // CSB and SCK have setup / hold relationships for SPI flash devices. Only\n // change counts on CSB posedge if there is at least one SCK cycle.\n always_ff @(posedge sck_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sck_toggle <= 1'b0;\n end else begin\n if (sck_pulse_en_i) begin\n sck_toggle <= ~csb_toggle;\n end\n end\n end\n\n // Signal CSB de-assertion with a change in count, but only do it if the\n // change originated from the SCK domain.\n always_ff @(posedge csb_i or negedge rst_ni) begin\n if (!rst_ni) begin\n csb_toggle <= 1'b0;\n end else begin\n csb_toggle <= sck_toggle;\n end\n end\n\n // clk_i is asynchronous to CSB/SCK, so use a synchronizer.\n prim_flop_2sync #(\n .Width (1)\n ) u_count_sync (\n .clk_i,\n .rst_ni,\n .d_i (csb_toggle),\n .q_o (sys_toggle)\n );\n\n // sys_toggle_last is used to generate the pulse on differences.\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sys_toggle_last <= 1'b0;\n end else begin\n sys_toggle_last <= sys_toggle;\n end\n end", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The passthrough gate only updates on CSb de-assertion and derives its value from the committed BUSY bit.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spid_csb_sync.sv:33", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (sck_toggle <= 1'b0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spid_csb_sync.sv (original at line [33]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "spi_device-t4-001"}
{"id": "spi_device-t4-003c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spid_csb_sync.sv", "license": "Apache-2.0"}, "spec_excerpt": "Note that the passthrough gate only updates on CSb de-assertion and derives its value from the committed `BUSY` bit.\nThis means that after the `BUSY` bit is set, there must be at least one command before the passthrough gate will open again.", "rtl_excerpt": " // CSB and SCK have setup / hold relationships for SPI flash devices. Only\n // change counts on CSB posedge if there is at least one SCK cycle.\n always_ff @(posedge sck_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sck_toggle <= 1'b0;\n end else begin\n if (sck_pulse_en_i) begin\n sck_toggle <= ~csb_toggle;\n end\n end\n end\n\n // Signal CSB de-assertion with a change in count, but only do it if the\n // change originated from the SCK domain.\n always_ff @(posedge csb_i or negedge rst_ni) begin\n if (!rst_ni) begin\n csb_toggle <= 1'b0;\n end else begin\n csb_toggle <= sck_toggle;\n end\n end\n\n // clk_i is asynchronous to CSB/SCK, so use a synchronizer.\n prim_flop_2sync #(\n .Width (1)\n ) u_count_sync (\n .clk_i,\n .rst_ni,\n .d_i (csb_toggle),\n .q_o (sys_toggle)\n );\n\n // sys_toggle_last is used to generate the pulse on differences.\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sys_toggle_last <= 1'b0;\n end else begin\n sys_toggle_last <= sys_toggle;\n end\n end\n\n assign csb_deasserted_pulse_o = (sys_toggle != sys_toggle_last);\nendmodule : spid_csb_sync\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The passthrough gate only updates on CSb de-assertion and derives its value from the committed BUSY bit.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spid_csb_sync.sv:64", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (sys_toggle_last <= 1'b0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spid_csb_sync.sv (original at line [64]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "easy", "paired_violation": "spi_device-t4-003"}
{"id": "spi_device-t4-006c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spid_csb_sync.sv", "license": "Apache-2.0"}, "spec_excerpt": "Note that the passthrough gate only updates on CSb de-assertion and derives its value from the committed `BUSY` bit.\nThis means that after the `BUSY` bit is set, there must be at least one command before the passthrough gate will open again.", "rtl_excerpt": "// Copyright lowRISC contributors (OpenTitan project).\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n\n// spid_csb_sync detects the deassertion edge (positive edge) of CSB for\n// spi_device. With a prim_edge_detector alone, CSB would have pulse width\n// requirements relative to clk_i, and these could be restrictive relative to\n// the downstream SPI flash.\n//\n// Instead, use a CSB-clocked toggle and detect the much slower-changing\n// toggles, making use of CSB's low duty cycle.\n//\n// In addition, this module filters CSB \"cycles\" without SPI clocks.\n// The sck_pulse_en_i input allows further filtering of CSB-triggered pulses.\n// For example, this can be used to trigger a pulse only when there is a new\n// uploaded command.\n\nmodule spid_csb_sync (\n input clk_i,\n input rst_ni,\n input sck_i,\n input sck_pulse_en_i,\n input csb_i,\n output csb_deasserted_pulse_o\n);\n\n logic sck_toggle, csb_toggle, sys_toggle, sys_toggle_last;\n\n // CSB and SCK have setup / hold relationships for SPI flash devices. Only\n // change counts on CSB posedge if there is at least one SCK cycle.\n always_ff @(posedge sck_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sck_toggle <= 1'b0;\n end else begin\n if (sck_pulse_en_i) begin\n sck_toggle <= ~csb_toggle;\n end\n end\n end\n\n // Signal CSB de-assertion with a change in count, but only do it if the\n // change originated from the SCK domain.\n always_ff @(posedge csb_i or negedge rst_ni) begin\n if (!rst_ni) begin\n csb_toggle <= 1'b0;\n end else begin\n csb_toggle <= sck_toggle;\n end\n end\n\n // clk_i is asynchronous to CSB/SCK, so use a synchronizer.\n prim_flop_2sync #(\n .Width (1)\n ) u_count_sync (\n .clk_i,\n .rst_ni,\n .d_i (csb_toggle),\n .q_o (sys_toggle)\n );\n\n // sys_toggle_last is used to generate the pulse on differences.\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sys_toggle_last <= 1'b0;\n end else begin\n sys_toggle_last <= sys_toggle;\n end\n end\n\n assign csb_deasserted_pulse_o = (sys_toggle != sys_toggle_last);\nendmodule : spid_csb_sync", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The passthrough gate only updates on CSb de-assertion and derives its value from the committed BUSY bit.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spid_csb_sync.sv:36", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (sck_toggle <= ~csb_toggle;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spid_csb_sync.sv (original at line [36]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "spi_device-t4-006"}
{"id": "spi_device-t4-009c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spid_csb_sync.sv", "license": "Apache-2.0"}, "spec_excerpt": "Note that the passthrough gate only updates on CSb de-assertion and derives its value from the committed `BUSY` bit.\nThis means that after the `BUSY` bit is set, there must be at least one command before the passthrough gate will open again.", "rtl_excerpt": "// the downstream SPI flash.\n//\n// Instead, use a CSB-clocked toggle and detect the much slower-changing\n// toggles, making use of CSB's low duty cycle.\n//\n// In addition, this module filters CSB \"cycles\" without SPI clocks.\n// The sck_pulse_en_i input allows further filtering of CSB-triggered pulses.\n// For example, this can be used to trigger a pulse only when there is a new\n// uploaded command.\n\nmodule spid_csb_sync (\n input clk_i,\n input rst_ni,\n input sck_i,\n input sck_pulse_en_i,\n input csb_i,\n output csb_deasserted_pulse_o\n);\n\n logic sck_toggle, csb_toggle, sys_toggle, sys_toggle_last;\n\n // CSB and SCK have setup / hold relationships for SPI flash devices. Only\n // change counts on CSB posedge if there is at least one SCK cycle.\n always_ff @(posedge sck_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sck_toggle <= 1'b0;\n end else begin\n if (sck_pulse_en_i) begin\n sck_toggle <= ~csb_toggle;\n end\n end\n end\n\n // Signal CSB de-assertion with a change in count, but only do it if the\n // change originated from the SCK domain.\n always_ff @(posedge csb_i or negedge rst_ni) begin\n if (!rst_ni) begin\n csb_toggle <= 1'b0;\n end else begin\n csb_toggle <= sck_toggle;\n end\n end\n\n // clk_i is asynchronous to CSB/SCK, so use a synchronizer.\n prim_flop_2sync #(\n .Width (1)\n ) u_count_sync (\n .clk_i,\n .rst_ni,\n .d_i (csb_toggle),\n .q_o (sys_toggle)\n );\n\n // sys_toggle_last is used to generate the pulse on differences.\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sys_toggle_last <= 1'b0;\n end else begin\n sys_toggle_last <= sys_toggle;\n end\n end\n\n assign csb_deasserted_pulse_o = (sys_toggle != sys_toggle_last);\nendmodule : spid_csb_sync\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The passthrough gate only updates on CSb de-assertion and derives its value from the committed BUSY bit.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spid_csb_sync.sv:43", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (always_ff @(posedge csb_i or negedge rst_ni) begin). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spid_csb_sync.sv (original at line [43]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "spi_device-t4-009"}
{"id": "spi_device-t4-014c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spi_s2p.sv", "license": "Apache-2.0"}, "spec_excerpt": "| 3 | rw | 0x0 | rx_order | RX bit order on SDI. Module stores bitstream from MSB to LSB if value is 0. |", "rtl_excerpt": "\n DualIO: begin\n data_d = (order_i) ? {s_i[1:0], data_q[7:2]} : {data_q[5:0], s_i[1:0]};\n end\n\n QuadIO: begin\n data_d = (order_i) ? {s_i[3:0], data_q[7:4]} : {data_q[3:0], s_i[3:0]};\n end\n\n default: begin\n data_d = data_q;\n end\n endcase\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n data_q <= '0;\n end else begin\n data_q <= data_d;\n end\n end\n\n // send un-latched data\n assign data_o = data_d;\n\n // Bitcount in a byte\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n cnt <= count_t'(Bits-1);\n end else if (cnt == '0) begin\n cnt <= count_t'(Bits-1);\n end else begin\n unique case (io_mode_i)\n SingleIO: cnt <= cnt - count_t'('h1);\n DualIO: cnt <= cnt - count_t'('h2);\n QuadIO: cnt <= cnt - count_t'('h4);\n default: cnt <= cnt;\n endcase\n end\n end\n\n // data valid\n always_comb begin\n unique case (io_mode_i)\n SingleIO: data_valid_o = (cnt == 'h0);\n DualIO: data_valid_o = (cnt == 'h1);\n QuadIO: data_valid_o = (cnt == 'h3);\n default: data_valid_o = 1'b 0;\n endcase\n end\n\n ////////////////\n // Assertions //\n ////////////////\n\n // Right after reset (CSb assert), the io_mode_i shall be Single IO\n // to decode SPI Opcode.\n `ASSERT(IoModeDefault_A, $rose(rst_ni) |-> io_mode_i == SingleIO, clk_i, 0)\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "RX bit order on SDI. Module stores bitstream from MSB to LSB if value is 0.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spi_s2p.sv:83", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (DualIO: cnt <= cnt - count_t'('h2);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_s2p.sv (original at line [84]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "hard", "paired_violation": "spi_device-t4-014"}
{"id": "spi_device-t4-016c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spi_s2p.sv", "license": "Apache-2.0"}, "spec_excerpt": "| 3 | rw | 0x0 | rx_order | RX bit order on SDI. Module stores bitstream from MSB to LSB if value is 0. |", "rtl_excerpt": " DualIO: begin\n data_d = (order_i) ? {s_i[1:0], data_q[7:2]} : {data_q[5:0], s_i[1:0]};\n end\n\n QuadIO: begin\n data_d = (order_i) ? {s_i[3:0], data_q[7:4]} : {data_q[3:0], s_i[3:0]};\n end\n\n default: begin\n data_d = data_q;\n end\n endcase\n end\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n data_q <= '0;\n end else begin\n data_q <= data_d;\n end\n end\n\n // send un-latched data\n assign data_o = data_d;\n\n // Bitcount in a byte\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n cnt <= count_t'(Bits-1);\n end else if (cnt == '0) begin\n cnt <= count_t'(Bits-1);\n end else begin\n unique case (io_mode_i)\n SingleIO: cnt <= cnt - count_t'('h1);\n DualIO: cnt <= cnt - count_t'('h2);\n QuadIO: cnt <= cnt - count_t'('h4);\n default: cnt <= cnt;\n endcase\n end\n end\n\n // data valid\n always_comb begin\n unique case (io_mode_i)\n SingleIO: data_valid_o = (cnt == 'h0);\n DualIO: data_valid_o = (cnt == 'h1);\n QuadIO: data_valid_o = (cnt == 'h3);\n default: data_valid_o = 1'b 0;\n endcase\n end\n\n ////////////////\n // Assertions //\n ////////////////\n\n // Right after reset (CSb assert), the io_mode_i shall be Single IO\n // to decode SPI Opcode.\n `ASSERT(IoModeDefault_A, $rose(rst_ni) |-> io_mode_i == SingleIO, clk_i, 0)\n\nendmodule\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "RX bit order on SDI. Module stores bitstream from MSB to LSB if value is 0.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spi_s2p.sv:85", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (QuadIO: cnt <= cnt - count_t'('h4);). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_s2p.sv (original at line [85]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "easy", "paired_violation": "spi_device-t4-016"}
{"id": "spi_device-t4-018c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spi_s2p.sv", "license": "Apache-2.0"}, "spec_excerpt": "| 3 | rw | 0x0 | rx_order | RX bit order on SDI. Module stores bitstream from MSB to LSB if value is 0. |", "rtl_excerpt": "1: unique case (io_mode_i)\n2: SingleIO: begin\n3: data_d = (order_i) ? {s_i[0], data_q[7:1]} : {data_q[6:0], s_i[0]};\n4: end", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "RX bit order on SDI. Module stores bitstream from MSB to LSB if value is 0.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spi_s2p.sv:47", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (data_d = (order_i) ? {s_i[0], data_q[7:1]} : {data_q[6:0], s_i[0]};). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_s2p.sv (original at line [47])", "difficulty": "hard", "paired_violation": "spi_device-t4-018"}
{"id": "spi_host-t4-001c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "### CONTROL . SW_RST\nClears the internal state (not registers) to the reset state when set to 1,\n including the FIFOs, the CDC's, the core state machine and the shift register.", "rtl_excerpt": " // Buffer the rx_data outputs to simplify three-way flow control\n // between fsm, shift reg and byte_merge.\n assign rd_ready_o = ~rx_buf_valid_q | (rx_valid_o & rx_ready_i);\n assign rx_valid_o = rx_buf_valid_q;\n\n assign rx_buf_d = sw_rst_i ? 9'h0 :\n (rd_en_i && rd_ready_o) ? {last_read_i, sr_shifted} :\n rx_buf_q;\n\n assign rx_buf_valid_d = sw_rst_i ? 1'b0 :\n (rd_en_i && rd_ready_o) ? 1'b1 :\n (rx_valid_o & rx_ready_i) ? 1'b0 :\n rx_buf_valid_q;\n\n assign sd_i_d = sw_rst_i ? 4'b0 :\n sample_en_i ? sd_i :\n sd_i_q;\n\n assign {rx_last_o, rx_data_o} = rx_buf_q;\n\n // tx_data cannot be buffered, because of the\n // need to transmit tx_flush as we fetch the\n // last-needed byte.\n assign wr_ready_o = tx_valid_i;\n assign tx_ready_o = wr_en_i;\n assign tx_flush_o = last_write_i;\n\n assign sr_d = sw_rst_i ? 8'h0 :\n (wr_en_i & wr_ready_o) ? tx_data_i :\n shift_en_i ? sr_shifted :\n sr_q;\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sd_i_q <= 4'h0;\n sr_q <= 8'h0;\n rx_buf_valid_q <= 1'b0;\n rx_buf_q <= 9'h0;\n end else begin\n sd_i_q <= sd_i_d;\n sr_q <= sr_d;\n rx_buf_valid_q <= rx_buf_valid_d;\n rx_buf_q <= rx_buf_d;\n end\n end\n\nendmodule : spi_host_shift_register\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "CONTROL.SW_RST clears the internal state to the reset state when set to 1, including the shift register.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:102", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (sr_q <= 8'h0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [104]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "spi_host-t4-001"}
{"id": "spi_host-t4-005c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "Finally *within a given byte*, the most significant bits are transmitted and received first.\nFor Dual and Quad transactions the least significant bit in any instantaneous pair or nibble is transmitted or received on `SD[0]`, and the remaining SD bits (1 though 3) are populated in order of increasing significance.", "rtl_excerpt": "1: 8'h00;\n2: \n3: assign sd_o = (speed_i == Standard) ? {3'b000, sr_q[7]} :\n4: (speed_i == Dual) ? {2'b00, sr_q[7:6]} :\n5: (speed_i == Quad) ? {sr_q[7:4]} :", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "Within a given byte, the most significant bits are transmitted and received first.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:62", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign sd_o = (speed_i == Standard) ? {3'b000, sr_q[7]} :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [64])", "difficulty": "medium", "paired_violation": "spi_host-t4-005"}
{"id": "spi_host-t4-007c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "Finally *within a given byte*, the most significant bits are transmitted and received first.\nFor Dual and Quad transactions the least significant bit in any instantaneous pair or nibble is transmitted or received on `SD[0]`, and the remaining SD bits (1 though 3) are populated in order of increasing significance.", "rtl_excerpt": "1: \n2: assign sd_o = (speed_i == Standard) ? {3'b000, sr_q[7]} :\n3: (speed_i == Dual) ? {2'b00, sr_q[7:6]} :\n4: (speed_i == Quad) ? {sr_q[7:4]} :\n5: 4'h0;", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The least significant bit in any instantaneous pair or nibble is transmitted or received on SD[0], and the remaining SD bits (1 though 3) are populated in order of increasing significance.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:63", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly ((speed_i == Dual) ? {2'b00, sr_q[7:6]} :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [65])", "difficulty": "medium", "paired_violation": "spi_host-t4-007"}
{"id": "spi_host-t4-009c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "the SPI_HOST IP offers a modified \"Full-cycle\" ([`CONFIGOPTS.FULLCYC`](registers.md#configopts--fullcyc)) timing mode where data can be sampled a *full* cycle after the target device asserts data on the SD bus.\nThis full cycle mode has no effect on any of the signals transmitted, only on the timing of the sampling of the incoming signals.", "rtl_excerpt": " input last_write_i,\n\n input [7:0] tx_data_i,\n input tx_valid_i,\n output tx_ready_o,\n output tx_flush_o,\n\n output logic [7:0] rx_data_o,\n output logic rx_valid_o,\n input rx_ready_i,\n output logic rx_last_o,\n\n input [3:0] sd_i,\n output logic [3:0] sd_o,\n\n input sw_rst_i\n);\n import spi_host_cmd_pkg::*;\n\n logic [7:0] sr_q;\n logic [7:0] sr_d;\n logic [3:0] sd_i_q, sd_i_d;\n logic [3:0] next_bits;\n logic [7:0] sr_shifted;\n\n // 9-bit buffer to hold shift register data\n // and the last_read bit to indicate whether\n // it is the last in a series.\n logic [8:0] rx_buf_q;\n logic [8:0] rx_buf_d;\n logic rx_buf_valid_q;\n logic rx_buf_valid_d;\n\n `ASSERT(SpeedValid, speed_i != RsvdSpd, clk_i, rst_ni)\n\n assign next_bits = full_cyc_i ? sd_i : sd_i_q;\n assign sr_shifted = (speed_i == Standard) ? {sr_q[6:0], next_bits[1]} :\n (speed_i == Dual) ? {sr_q[5:0], next_bits[1:0]} :\n (speed_i == Quad) ? {sr_q[3:0], next_bits[3:0]} :\n 8'h00;\n\n assign sd_o = (speed_i == Standard) ? {3'b000, sr_q[7]} :\n (speed_i == Dual) ? {2'b00, sr_q[7:6]} :\n (speed_i == Quad) ? {sr_q[7:4]} :\n 4'h0;\n\n // Buffer the rx_data outputs to simplify three-way flow control\n // between fsm, shift reg and byte_merge.\n assign rd_ready_o = ~rx_buf_valid_q | (rx_valid_o & rx_ready_i);\n assign rx_valid_o = rx_buf_valid_q;\n\n assign rx_buf_d = sw_rst_i ? 9'h0 :\n (rd_en_i && rd_ready_o) ? {last_read_i, sr_shifted} :\n rx_buf_q;\n\n assign rx_buf_valid_d = sw_rst_i ? 1'b0 :\n (rd_en_i && rd_ready_o) ? 1'b1 :\n (rx_valid_o & rx_ready_i) ? 1'b0 :\n rx_buf_valid_q;\n\n assign sd_i_d = sw_rst_i ? 4'b0 :\n sample_en_i ? sd_i :\n sd_i_q;\n\n assign {rx_last_o, rx_data_o} = rx_buf_q;\n\n // tx_data cannot be buffered, because of the\n // need to transmit tx_flush as we fetch the\n // last-needed byte.\n assign wr_ready_o = tx_valid_i;\n assign tx_ready_o = wr_en_i;", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "This full cycle mode has no effect on any of the signals transmitted, only on the timing of the sampling of the incoming signals.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:56", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (assign next_bits = full_cyc_i ? sd_i : sd_i_q;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [58]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "spi_host-t4-009"}
{"id": "spi_host-t4-011c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "the SPI_HOST IP offers a modified \"Full-cycle\" ([`CONFIGOPTS.FULLCYC`](registers.md#configopts--fullcyc)) timing mode where data can be sampled a *full* cycle after the target device asserts data on the SD bus.\nThis full cycle mode has no effect on any of the signals transmitted, only on the timing of the sampling of the incoming signals.", "rtl_excerpt": " // and the last_read bit to indicate whether\n // it is the last in a series.\n logic [8:0] rx_buf_q;\n logic [8:0] rx_buf_d;\n logic rx_buf_valid_q;\n logic rx_buf_valid_d;\n\n `ASSERT(SpeedValid, speed_i != RsvdSpd, clk_i, rst_ni)\n\n assign next_bits = full_cyc_i ? sd_i : sd_i_q;\n assign sr_shifted = (speed_i == Standard) ? {sr_q[6:0], next_bits[1]} :\n (speed_i == Dual) ? {sr_q[5:0], next_bits[1:0]} :\n (speed_i == Quad) ? {sr_q[3:0], next_bits[3:0]} :\n 8'h00;\n\n assign sd_o = (speed_i == Standard) ? {3'b000, sr_q[7]} :\n (speed_i == Dual) ? {2'b00, sr_q[7:6]} :\n (speed_i == Quad) ? {sr_q[7:4]} :\n 4'h0;\n\n // Buffer the rx_data outputs to simplify three-way flow control\n // between fsm, shift reg and byte_merge.\n assign rd_ready_o = ~rx_buf_valid_q | (rx_valid_o & rx_ready_i);\n assign rx_valid_o = rx_buf_valid_q;\n\n assign rx_buf_d = sw_rst_i ? 9'h0 :\n (rd_en_i && rd_ready_o) ? {last_read_i, sr_shifted} :\n rx_buf_q;\n\n assign rx_buf_valid_d = sw_rst_i ? 1'b0 :\n (rd_en_i && rd_ready_o) ? 1'b1 :\n (rx_valid_o & rx_ready_i) ? 1'b0 :\n rx_buf_valid_q;\n\n assign sd_i_d = sw_rst_i ? 4'b0 :\n sample_en_i ? sd_i :\n sd_i_q;\n\n assign {rx_last_o, rx_data_o} = rx_buf_q;\n\n // tx_data cannot be buffered, because of the\n // need to transmit tx_flush as we fetch the\n // last-needed byte.\n assign wr_ready_o = tx_valid_i;\n assign tx_ready_o = wr_en_i;\n assign tx_flush_o = last_write_i;\n\n assign sr_d = sw_rst_i ? 8'h0 :\n (wr_en_i & wr_ready_o) ? tx_data_i :\n shift_en_i ? sr_shifted :\n sr_q;\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sd_i_q <= 4'h0;\n sr_q <= 8'h0;\n rx_buf_valid_q <= 1'b0;\n rx_buf_q <= 9'h0;\n end else begin\n sd_i_q <= sd_i_d;\n sr_q <= sr_d;\n rx_buf_valid_q <= rx_buf_valid_d;\n rx_buf_q <= rx_buf_d;\n end\n end\n\nendmodule : spi_host_shift_register\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "Data can be sampled a full cycle after the target device asserts data on the SD bus.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:82", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly (sample_en_i ? sd_i :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [84]); excerpt widened to +/-35 lines per fairness audit", "difficulty": "medium", "paired_violation": "spi_host-t4-011"}
{"id": "spi_host-t4-019c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "Finally *within a given byte*, the most significant bits are transmitted and received first.\nFor Dual and Quad transactions the least significant bit in any instantaneous pair or nibble is transmitted or received on `SD[0]`, and the remaining SD bits (1 though 3) are populated in order of increasing significance.", "rtl_excerpt": "1: \n2: assign sd_o = (speed_i == Standard) ? {3'b000, sr_q[7]} :\n3: (speed_i == Dual) ? {2'b00, sr_q[7:6]} :\n4: (speed_i == Quad) ? {sr_q[7:4]} :\n5: 4'h0;", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The least significant bit in any instantaneous pair or nibble is transmitted or received on SD[0], and the remaining SD bits (1 though 3) are populated in order of increasing significance.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:63", "explanation": "Control item: the RTL shown is the original, unmutated OpenTitan code, which implements the rule correctly ((speed_i == Dual) ? {2'b00, sr_q[7:6]} :). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [65])", "difficulty": "medium", "paired_violation": "spi_host-t4-019"}
{"id": "spi_device-t4-002c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_device/rtl/spid_csb_sync.sv", "license": "Apache-2.0"}, "spec_excerpt": "Note that the passthrough gate only updates on CSb de-assertion and derives its value from the committed `BUSY` bit.\nThis means that after the `BUSY` bit is set, there must be at least one command before the passthrough gate will open again.", "rtl_excerpt": "// Instead, use a CSB-clocked toggle and detect the much slower-changing\n// toggles, making use of CSB's low duty cycle.\n//\n// In addition, this module filters CSB \"cycles\" without SPI clocks.\n// The sck_pulse_en_i input allows further filtering of CSB-triggered pulses.\n// For example, this can be used to trigger a pulse only when there is a new\n// uploaded command.\n\nmodule spid_csb_sync (\n input clk_i,\n input rst_ni,\n input sck_i,\n input sck_pulse_en_i,\n input csb_i,\n output csb_deasserted_pulse_o\n);\n\n logic sck_toggle, csb_toggle, sys_toggle, sys_toggle_last;\n\n // CSB and SCK have setup / hold relationships for SPI flash devices. Only\n // change counts on CSB posedge if there is at least one SCK cycle.\n always_ff @(posedge sck_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sck_toggle <= 1'b0;\n end else begin\n if (sck_pulse_en_i) begin\n sck_toggle <= ~csb_toggle;\n end\n end\n end\n\n // Signal CSB de-assertion with a change in count, but only do it if the\n // change originated from the SCK domain.\n always_ff @(posedge csb_i or negedge rst_ni) begin\n if (!rst_ni) begin\n csb_toggle <= 1'b0;\n end else begin\n csb_toggle <= sck_toggle;\n end\n end\n\n // clk_i is asynchronous to CSB/SCK, so use a synchronizer.\n prim_flop_2sync #(\n .Width (1)\n ) u_count_sync (\n .clk_i,\n .rst_ni,\n .d_i (csb_toggle),\n .q_o (sys_toggle)\n );\n\n // sys_toggle_last is used to generate the pulse on differences.\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sys_toggle_last <= 1'b0;\n end else begin\n sys_toggle_last <= sys_toggle;\n end\n end\n\n assign csb_deasserted_pulse_o = (sys_toggle != sys_toggle_last);\nendmodule : spid_csb_sync\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "The passthrough gate only updates on CSb de-assertion and derives its value from the committed BUSY bit.", "category": null, "rtl_location": "hw/ip/spi_device/rtl/spid_csb_sync.sv:45", "explanation": "Control item: original unmutated OpenTitan code (csb_toggle <= 1'b0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spid_csb_sync.sv (original at line [45]); excerpt widened to +/-35 lines", "difficulty": "medium", "paired_violation": "spi_device-t4-002"}
{"id": "spi_host-t4-002c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "32-bit words placed in [`TXDATA`](registers.md#txdata) are transmitted in first-in-first-out order.\nLikewise, words received from the SPI data lines are made available for reading from [`RXDATA`](registers.md#rxdata) in first-in-first-out order.", "rtl_excerpt": " // between fsm, shift reg and byte_merge.\n assign rd_ready_o = ~rx_buf_valid_q | (rx_valid_o & rx_ready_i);\n assign rx_valid_o = rx_buf_valid_q;\n\n assign rx_buf_d = sw_rst_i ? 9'h0 :\n (rd_en_i && rd_ready_o) ? {last_read_i, sr_shifted} :\n rx_buf_q;\n\n assign rx_buf_valid_d = sw_rst_i ? 1'b0 :\n (rd_en_i && rd_ready_o) ? 1'b1 :\n (rx_valid_o & rx_ready_i) ? 1'b0 :\n rx_buf_valid_q;\n\n assign sd_i_d = sw_rst_i ? 4'b0 :\n sample_en_i ? sd_i :\n sd_i_q;\n\n assign {rx_last_o, rx_data_o} = rx_buf_q;\n\n // tx_data cannot be buffered, because of the\n // need to transmit tx_flush as we fetch the\n // last-needed byte.\n assign wr_ready_o = tx_valid_i;\n assign tx_ready_o = wr_en_i;\n assign tx_flush_o = last_write_i;\n\n assign sr_d = sw_rst_i ? 8'h0 :\n (wr_en_i & wr_ready_o) ? tx_data_i :\n shift_en_i ? sr_shifted :\n sr_q;\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sd_i_q <= 4'h0;\n sr_q <= 8'h0;\n rx_buf_valid_q <= 1'b0;\n rx_buf_q <= 9'h0;\n end else begin\n sd_i_q <= sd_i_d;\n sr_q <= sr_d;\n rx_buf_valid_q <= rx_buf_valid_d;\n rx_buf_q <= rx_buf_d;\n end\n end\n\nendmodule : spi_host_shift_register\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "Words received from the SPI data lines are made available for reading from RXDATA in first-in-first-out order.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:103", "explanation": "Control item: original unmutated OpenTitan code (rx_buf_valid_q <= 1'b0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [105]); excerpt widened to +/-35 lines", "difficulty": "easy", "paired_violation": "spi_host-t4-002"}
{"id": "spi_host-t4-004c", "task_type": 4, "control": true, "source": {"repo": "https://github.com/lowRISC/opentitan", "commit": "80b5b3213453156fe62683962664d1afd9695ec4", "file": "hw/ip/spi_host/rtl/spi_host_shift_register.sv", "license": "Apache-2.0"}, "spec_excerpt": "For RX (or Bidirectional) segments, if the last few bytes received do not fill an entire DATA word, the partial word will be zero-padded and inserted into the RX FIFO once the segment is completed.", "rtl_excerpt": " assign rd_ready_o = ~rx_buf_valid_q | (rx_valid_o & rx_ready_i);\n assign rx_valid_o = rx_buf_valid_q;\n\n assign rx_buf_d = sw_rst_i ? 9'h0 :\n (rd_en_i && rd_ready_o) ? {last_read_i, sr_shifted} :\n rx_buf_q;\n\n assign rx_buf_valid_d = sw_rst_i ? 1'b0 :\n (rd_en_i && rd_ready_o) ? 1'b1 :\n (rx_valid_o & rx_ready_i) ? 1'b0 :\n rx_buf_valid_q;\n\n assign sd_i_d = sw_rst_i ? 4'b0 :\n sample_en_i ? sd_i :\n sd_i_q;\n\n assign {rx_last_o, rx_data_o} = rx_buf_q;\n\n // tx_data cannot be buffered, because of the\n // need to transmit tx_flush as we fetch the\n // last-needed byte.\n assign wr_ready_o = tx_valid_i;\n assign tx_ready_o = wr_en_i;\n assign tx_flush_o = last_write_i;\n\n assign sr_d = sw_rst_i ? 8'h0 :\n (wr_en_i & wr_ready_o) ? tx_data_i :\n shift_en_i ? sr_shifted :\n sr_q;\n\n always_ff @(posedge clk_i or negedge rst_ni) begin\n if (!rst_ni) begin\n sd_i_q <= 4'h0;\n sr_q <= 8'h0;\n rx_buf_valid_q <= 1'b0;\n rx_buf_q <= 9'h0;\n end else begin\n sd_i_q <= sd_i_d;\n sr_q <= sr_d;\n rx_buf_valid_q <= rx_buf_valid_d;\n rx_buf_q <= rx_buf_d;\n end\n end\n\nendmodule : spi_host_shift_register\n", "question": "Does this RTL comply with the spec excerpt? If it violates the spec, cite the violated rule and name the violation category.", "answer_format": "location+category", "gold_answer": {"verdict": "consistent", "rule": "For RX segments, if the last few bytes received do not fill an entire DATA word, the partial word will be zero-padded.", "category": null, "rtl_location": "hw/ip/spi_host/rtl/spi_host_shift_register.sv:104", "explanation": "Control item: original unmutated OpenTitan code (rx_buf_q <= 9'h0;). No violation exists."}, "mutation": null, "verification": "control: original code restored from mutation record; source check: confirmed spi_host_shift_register.sv (original at line [106]); excerpt widened to +/-35 lines", "difficulty": "medium", "paired_violation": "spi_host-t4-004"}