Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions hw/ip/acc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ All read-write (RW) CSRs are set to 0 when ACC starts an operation (when 1 is wr
<td>
Write to this CSR to set the configuration for KMAC message requests.
Bit [31] Cfg Done
Bit [20] Masked Mode
Bits [19:8] Number of 64-bit words in message
Bits [7:5] Number of bytes in final word
Bits [4:2] Keccak Strength
Expand All @@ -290,8 +291,6 @@ All read-write (RW) CSRs are set to 0 when ACC starts an operation (when 1 is wr
<td>KMAC_STATUS</td>
<td>
Contains status bits for KMAC operations and return digest
Bit [4] MSG Undersized Error
Bit [3] MSG Oversized Error
Bit [2] Digest error
Bit [1] KMAC Ready
Bit [0] Digest Done
Expand Down Expand Up @@ -418,14 +417,6 @@ All read-write (RW) WSRs are set to 0 when ACC starts an operation (when 1 is wr
The accumulator register used by the {{#acc-insn-ref BN.MULQACC}} instruction.
</td>
</tr>
<tr>
<td>0xB</td>
<td>RW</td>
<td><a name="acch">ACCH</a></td>
<td>
The high bits of the accumulator register used by the {{#acc-insn-ref BN.MULV}} instruction.
</td>
</tr>
<tr>
<td>0x4</td>
<td>RO</td>
Expand Down Expand Up @@ -482,7 +473,7 @@ All read-write (RW) WSRs are set to 0 when ACC starts an operation (when 1 is wr
<td>RW</td>
<td><a name="kmac-msg">KMAC_MSG</a></td>
<td>
The kmac message data to send over the AppIntf.
The kmac message data share0 to send over the AppIntf.
A byte mask is applied to the message from the kmac_partial_write WSR value before being written into the internal MSG FIFO.
</td>
</tr>
Expand All @@ -491,7 +482,32 @@ All read-write (RW) WSRs are set to 0 when ACC starts an operation (when 1 is wr
<td>RW</td>
<td><a name="kmac-digest">KMAC_DIGEST</a></td>
<td>
Return digest from AppIntf.
Return digest share 0 from AppIntf. In unmasked kmac_cfg this is the whole digest.
</td>
</tr>
<tr>
<td>0xB</td>
<td>RW</td>
<td><a name="acch">ACCH</a></td>
<td>
The high 256-bits of the accumulator register used by the {{#acc-insn-ref BN.MULV}} instruction.
</td>
</tr>
<tr>
<td>0xC</td>
<td>RW</td>
<td><a name="kmac-msg1">KMAC_MSG1</a></td>
<td>
The kmac message data share1 to send over the AppIntf. In unmasked kmac_cfg writing to this WSR is illegal.
A byte mask is applied to the message from the kmac_partial_write WSR value before being written into the internal MSG FIFO.
</td>
</tr>
<tr>
<td>0xD</td>
<td>RW</td>
<td><a name="kmac-digest1">KMAC_DIGEST1</a></td>
<td>
Return digest share 1 from AppIntf. In unmasked kmac_cfg reading from this WSR is illegal.
</td>
</tr>
</tbody>
Expand Down
1 change: 1 addition & 0 deletions hw/ip/acc/acc.core
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ filesets:
- rtl/acc_rf_bignum_fpga.sv
- rtl/acc_lsu.sv
- rtl/acc_alu_base.sv
- rtl/acc_digest_mux.sv
- rtl/acc_alu_bignum.sv
- rtl/acc_mac_bignum.sv
- rtl/bn_vec_core/unified_mul.sv
Expand Down
15 changes: 15 additions & 0 deletions hw/ip/acc/data/acc.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@
resval: 0,
desc: "An `RND_FIPS_CHK_FAIL` error was observed."
}
{ bits: "8",
name: "kmac_recov_error"
resval: 0,
desc: A "KMAC_RECOV_ERROR` recoverable error was observed."
}

// Fatal errors. Keep in sync with list in FATAL_ALERT_CAUSE.
{ bits: "16",
Expand Down Expand Up @@ -637,6 +642,11 @@
resval: 0,
desc: "A `FATAL_SOFTWARE` error was observed."
}
{ bits: "24",
name: "kmac_fatal_error"
resval: 0,
desc: A `KMAC_FATAL_ERROR` error was observed."
}
]
}
{ name: "FATAL_ALERT_CAUSE",
Expand Down Expand Up @@ -694,6 +704,11 @@
resval: 0,
desc: "A `FATAL_SOFTWARE` error was observed."
}
{ bits: "8",
name: "kmac_fatal_error"
resval: 0,
desc: "A `KMAC_FATAL_ERROR` error was observed."
}
]
}
{ name: "INSN_CNT",
Expand Down
8 changes: 8 additions & 0 deletions hw/ip/acc/data/acc_testplan.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
"acc_mac_bignum_acc_err",
"acc_urnd_err"]
}
{
name: kmac_error
desc: '''
Create bad transactions for the AppIntf that force ACC into a fatal error.
'''
stage: V2S
tests: ["acc_kmac_err"]
}
{
name: back_to_back
desc: '''
Expand Down
3 changes: 1 addition & 2 deletions hw/ip/acc/data/csr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
doc: |
Write to this CSR to set the configuration for KMAC message requests.
Bit [31] Cfg Done
Bit [20] Masked Mode
Bits [19:8] Number of 64-bit words in message
Bits [7:5] Number of bytes in final word
Bits [4:2] Keccak Strength
Expand All @@ -113,8 +114,6 @@
read-only: true
doc: |
Contains status bits for KMAC operations and return digest
Bit [4] MSG Undersized Error
Bit [3] MSG Oversized Error
Bit [2] Digest error
Bit [1] KMAC Ready
Bit [0] Digest Done
Expand Down
25 changes: 18 additions & 7 deletions hw/ip/acc/data/wsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
doc: |
The accumulator register used by the {{#acc-insn-ref BN.MULQACC}} instruction.

- name: acch
address: 11
doc: |
The high bits of the accumulator register used by the {{#acc-insn-ref BN.MULV}} instruction.

- name: key_s0_l
address: 4
read-only: true
Expand Down Expand Up @@ -87,10 +82,26 @@
- name: kmac_msg
address: 9
doc: |
The kmac message data to send over the AppIntf.
The kmac message data share0 to send over the AppIntf.
A byte mask is applied to the message from the kmac_partial_write WSR value before being written into the internal MSG FIFO.

- name: kmac_digest
address: 10
doc: |
Return digest from AppIntf.
Return digest share 0 from AppIntf. In unmasked kmac_cfg this is the whole digest.

- name: acch
address: 11
doc: |
The high 256-bits of the accumulator register used by the {{#acc-insn-ref BN.MULV}} instruction.

- name: kmac_msg1
address: 12
doc: |
The kmac message data share1 to send over the AppIntf. In unmasked kmac_cfg writing to this WSR is illegal.
A byte mask is applied to the message from the kmac_partial_write WSR value before being written into the internal MSG FIFO.

- name: kmac_digest1
address: 13
doc: |
Return digest share 1 from AppIntf. In unmasked kmac_cfg reading from this WSR is illegal.
53 changes: 28 additions & 25 deletions hw/ip/acc/doc/registers.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,34 +185,36 @@ The host CPU can clear this register when ACC is not running,
by writing any value. Write attempts while ACC is running are ignored.
- Offset: `0x1c`
- Reset default: `0x0`
- Reset mask: `0xff00ff`
- Reset mask: `0x1ff01ff`

### Fields

```wavejson
{"reg": [{"name": "bad_data_addr", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "bad_insn_addr", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "call_stack", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "illegal_insn", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "loop", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "key_invalid", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "rnd_rep_chk_fail", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "rnd_fips_chk_fail", "bits": 1, "attr": ["rw"], "rotate": -90}, {"bits": 8}, {"name": "imem_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "dmem_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "reg_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "bus_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "bad_internal_state", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "illegal_bus_access", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "lifecycle_escalation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "fatal_software", "bits": 1, "attr": ["rw"], "rotate": -90}, {"bits": 8}], "config": {"lanes": 1, "fontsize": 10, "vspace": 220}}
{"reg": [{"name": "bad_data_addr", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "bad_insn_addr", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "call_stack", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "illegal_insn", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "loop", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "key_invalid", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "rnd_rep_chk_fail", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "rnd_fips_chk_fail", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "kmac_recov_error", "bits": 1, "attr": ["rw"], "rotate": -90}, {"bits": 7}, {"name": "imem_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "dmem_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "reg_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "bus_intg_violation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "bad_internal_state", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "illegal_bus_access", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "lifecycle_escalation", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "fatal_software", "bits": 1, "attr": ["rw"], "rotate": -90}, {"name": "kmac_fatal_error", "bits": 1, "attr": ["rw"], "rotate": -90}, {"bits": 7}], "config": {"lanes": 1, "fontsize": 10, "vspace": 220}}
```

| Bits | Type | Reset | Name | Description |
|:------:|:------:|:-------:|:---------------------|:---------------------------------------------|
| 31:24 | | | | Reserved |
| 23 | rw | 0x0 | fatal_software | A `FATAL_SOFTWARE` error was observed. |
| 22 | rw | 0x0 | lifecycle_escalation | A `LIFECYCLE_ESCALATION` error was observed. |
| 21 | rw | 0x0 | illegal_bus_access | An `ILLEGAL_BUS_ACCESS` error was observed. |
| 20 | rw | 0x0 | bad_internal_state | A `BAD_INTERNAL_STATE` error was observed. |
| 19 | rw | 0x0 | bus_intg_violation | A `BUS_INTG_VIOLATION` error was observed. |
| 18 | rw | 0x0 | reg_intg_violation | A `REG_INTG_VIOLATION` error was observed. |
| 17 | rw | 0x0 | dmem_intg_violation | A `DMEM_INTG_VIOLATION` error was observed. |
| 16 | rw | 0x0 | imem_intg_violation | A `IMEM_INTG_VIOLATION` error was observed. |
| 15:8 | | | | Reserved |
| 7 | rw | 0x0 | rnd_fips_chk_fail | An `RND_FIPS_CHK_FAIL` error was observed. |
| 6 | rw | 0x0 | rnd_rep_chk_fail | An `RND_REP_CHK_FAIL` error was observed. |
| 5 | rw | 0x0 | key_invalid | A `KEY_INVALID` error was observed. |
| 4 | rw | 0x0 | loop | A `LOOP` error was observed. |
| 3 | rw | 0x0 | illegal_insn | An `ILLEGAL_INSN` error was observed. |
| 2 | rw | 0x0 | call_stack | A `CALL_STACK` error was observed. |
| 1 | rw | 0x0 | bad_insn_addr | A `BAD_INSN_ADDR` error was observed. |
| 0 | rw | 0x0 | bad_data_addr | A `BAD_DATA_ADDR` error was observed. |
| Bits | Type | Reset | Name | Description |
|:------:|:------:|:-------:|:---------------------|:------------------------------------------------------|
| 31:25 | | | | Reserved |
| 24 | rw | 0x0 | kmac_fatal_error | A `KMAC_FATAL_ERROR` error was observed." |
| 23 | rw | 0x0 | fatal_software | A `FATAL_SOFTWARE` error was observed. |
| 22 | rw | 0x0 | lifecycle_escalation | A `LIFECYCLE_ESCALATION` error was observed. |
| 21 | rw | 0x0 | illegal_bus_access | An `ILLEGAL_BUS_ACCESS` error was observed. |
| 20 | rw | 0x0 | bad_internal_state | A `BAD_INTERNAL_STATE` error was observed. |
| 19 | rw | 0x0 | bus_intg_violation | A `BUS_INTG_VIOLATION` error was observed. |
| 18 | rw | 0x0 | reg_intg_violation | A `REG_INTG_VIOLATION` error was observed. |
| 17 | rw | 0x0 | dmem_intg_violation | A `DMEM_INTG_VIOLATION` error was observed. |
| 16 | rw | 0x0 | imem_intg_violation | A `IMEM_INTG_VIOLATION` error was observed. |
| 15:9 | | | | Reserved |
| 8 | rw | 0x0 | kmac_recov_error | A "KMAC_RECOV_ERROR` recoverable error was observed." |
| 7 | rw | 0x0 | rnd_fips_chk_fail | An `RND_FIPS_CHK_FAIL` error was observed. |
| 6 | rw | 0x0 | rnd_rep_chk_fail | An `RND_REP_CHK_FAIL` error was observed. |
| 5 | rw | 0x0 | key_invalid | A `KEY_INVALID` error was observed. |
| 4 | rw | 0x0 | loop | A `LOOP` error was observed. |
| 3 | rw | 0x0 | illegal_insn | An `ILLEGAL_INSN` error was observed. |
| 2 | rw | 0x0 | call_stack | A `CALL_STACK` error was observed. |
| 1 | rw | 0x0 | bad_insn_addr | A `BAD_INSN_ADDR` error was observed. |
| 0 | rw | 0x0 | bad_data_addr | A `BAD_DATA_ADDR` error was observed. |

## FATAL_ALERT_CAUSE
Fatal Alert Cause Register
Expand All @@ -225,17 +227,18 @@ Refer to the "List of Errors" section for a detailed description of the
errors.
- Offset: `0x20`
- Reset default: `0x0`
- Reset mask: `0xff`
- Reset mask: `0x1ff`

### Fields

```wavejson
{"reg": [{"name": "imem_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "dmem_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "reg_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "bus_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "bad_internal_state", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "illegal_bus_access", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "lifecycle_escalation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "fatal_software", "bits": 1, "attr": ["ro"], "rotate": -90}, {"bits": 24}], "config": {"lanes": 1, "fontsize": 10, "vspace": 220}}
{"reg": [{"name": "imem_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "dmem_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "reg_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "bus_intg_violation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "bad_internal_state", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "illegal_bus_access", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "lifecycle_escalation", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "fatal_software", "bits": 1, "attr": ["ro"], "rotate": -90}, {"name": "kmac_fatal_error", "bits": 1, "attr": ["ro"], "rotate": -90}, {"bits": 23}], "config": {"lanes": 1, "fontsize": 10, "vspace": 220}}
```

| Bits | Type | Reset | Name | Description |
|:------:|:------:|:-------:|:---------------------|:---------------------------------------------|
| 31:8 | | | | Reserved |
| 31:9 | | | | Reserved |
| 8 | ro | 0x0 | kmac_fatal_error | A `KMAC_FATAL_ERROR` error was observed. |
| 7 | ro | 0x0 | fatal_software | A `FATAL_SOFTWARE` error was observed. |
| 6 | ro | 0x0 | lifecycle_escalation | A `LIFECYCLE_ESCALATION` error was observed. |
| 5 | ro | 0x0 | illegal_bus_access | A `ILLEGAL_BUS_ACCESS` error was observed. |
Expand Down
4 changes: 3 additions & 1 deletion hw/ip/acc/dv/accsim/sim/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ErrBits(IntEnum):
KEY_INVALID = 1 << 5
RND_REP_CHK_FAIL = 1 << 6
RND_FIPS_CHK_FAIL = 1 << 7
KMAC_RECOV_ERROR = 1 << 8
IMEM_INTG_VIOLATION = 1 << 16
DMEM_INTG_VIOLATION = 1 << 17
REG_INTG_VIOLATION = 1 << 18
Expand All @@ -40,7 +41,8 @@ class ErrBits(IntEnum):
ILLEGAL_BUS_ACCESS = 1 << 21
LIFECYCLE_ESCALATION = 1 << 22
FATAL_SOFTWARE = 1 << 23
MASK = (1 << 24) - 1
KMAC_FATAL_ERROR = 1 << 24
MASK = (1 << 25) - 1


class LcTx(IntEnum):
Expand Down
Loading
Loading