---
title: "CWE-1461: Hardware Simulation / Synthesis Mismatch"
url: https://radicalnotion.ai/cwe/cwe-1461
type: cwe
description: "The hardware design contains structures that are interpreted differently during synthesis than during simulation, which cause inconsistencies in security-relevant behavior between the synthesized implementation and the simulation."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1461: Hardware Simulation / Synthesis Mismatch

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The hardware design contains structures that are interpreted differently during synthesis than during simulation, which cause inconsistencies in security-relevant behavior between the synthesized implementation and the simulation.

Hardware-description-language (HDL) code describes functionality which can be verified as correct using simulation tools. Synthesis tools then (automatically) convert this into a physically-realizable representation. Certain HDL code structures cannot be exactly represented, or have multiple valid representations from which the synthesis tool must choose. This can result in output which behaves differently to the (functionally-correct) HDL code. These "simulation/synthesis mismatches" may have security consequences.

## Applicable platforms

**Languages:** Verilog (Undetermined), VHDL (Undetermined), Hardware Description Language (Undetermined)

**Technologies:** System on Chip (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Varies by Context | - |

## Potential mitigations

### Mitigation

Establish and enforce HDL coding and review practices that minimize differences between simulation semantics and synthesis interpretation. Avoid HDL constructs, synthesis directives, and tool-dependent behaviors known to cause simulation/synthesis mismatch, with particular attention to security-relevant logic.

Effectiveness: High. Avoidance of the patterns of code which can result in these errors removes the opportunity for error. However, in some cases (notably state machine encodings) this can be very difficult to achieve efficiently.

### Mitigation

For security-critical logic, preserve intentional redundancy that is required for security. Examples may include redundant logic, triple modular redundancy (TMR) structures, Hamming-distance state encodings, or state-machine recovery logic. Use synthesis constraints, preservation attributes, carefully controlled structural implementation, or manual implementation of selected critical blocks to prevent this redundancy from being merged, re-encoded, or optimized away.

Effectiveness: High. This mitigation removes the structures which cause the problem, at the expense of additional design and verification effort, and additional risk of inclusion of other functional errors.

## Detection methods

### Automated Static Analysis - Source Code

HDL linting, rule-based static analysis, and HDL checker tools can examine source code for structures that may be interpreted differently by simulation and synthesis tools. They may identify synthesis-sensitive coding patterns associated with this weakness.

Effectiveness: Moderate. This method can be useful for detecting potential coding issues, but it may not reveal whether these constructs result in observable behavioral divergence after synthesis. Moreover, a user may suppress or bypass these warnings and still produce the erroneous synthesized hardware implementation. This method can give false positives.

### Manual Analysis

Synthesis warning review can examine synthesis logs and reports for tool messages associated with possible simulation/synthesis mismatch. It may identify ignored constructs, unsupported HDL semantics, synthesis assumptions, or optimizations that could affect security-relevant behavior.

Effectiveness: Limited. Can reveal potential synthesis issues but relies on engineers interpreting warnings. Moreover, a user may suppress or bypass these warnings and still produce the erroneous synthesized hardware implementation.

### Formal Verification

HDL-source-to-netlist formal equivalence checking can examine the simulated model and synthesized netlist for behavioral mismatch associated with this weakness. It may identify non-equivalent outputs, failed compare-points, state-mapping issues, or counterexamples under the checked constraints.

Effectiveness: High. Formal equivalence checking can be effective at the IP level for identifying mismatches between the source-code model and synthesized implementation. However, effectiveness may decrease as design complexity grows, particularly at the SoC level, due to state-space expansion and difficulty mapping non-equivalent points. Synthesis optimizations may merge, eliminate, or rename signals, which can also produce false positives or require additional setup to account for expected transformations.

### Simulation / Emulation

Cross-simulation across HDL-source and post-synthesis models can examine both abstraction levels for observable behavioral divergence associated with this weakness. It may identify mismatches when security-relevant behaviors are explicitly exercised.

Effectiveness: High. This method can be useful for detecting observable behavioral mismatches, but it may not exercise all execution scenarios and should be combined with other detection methods to improve coverage.

### Fuzzing

Coverage-guided differential fuzzing can examine HDL source code and synthesized implementation models for behavioral divergence associated with this weakness. It may identify generated inputs or state conditions that expose synthesis-induced mismatches.

Effectiveness: High. This method can be useful for detecting previously unknown synthesis-induced behavioral mismatches by exploring diverse execution paths through coverage-guided input generation. However, it may not exercise every reachable design state and should be combined with other detection methods to improve coverage.

## Demonstrative examples

### Example 1

A hardware designer implements an access control latch which takes in lock and unlock signals (which are only active for a single cycle) and a reset signal, and outputs an unlocked state signal. During operation, the unlocked signal is synchronously set high by the unlock input and set low by the lock input. The unlocked signal also intended to be low from startup and set low by reset.

Bad code:

```verilog
module lock_control (
    input  wire clk,
    input  wire reset,
    input  wire lock,
    input  wire unlock,
    output reg  unlocked
);

    reg unlocked_next = 1'b0;

    always @(lock or unlock or unlocked) begin
        if (reset == 1'b1) begin
            unlocked_next = 1'b1;
        end else if (lock == 1'b1) begin
            unlocked_next = 1'b0;
        end else if (unlock == 1'b1) begin
            unlocked_next = 1'b1;
        end else begin
            unlocked_next = unlocked;
        end
    end

    always @(posedge clk) begin
        unlocked <= unlocked_next;
    end

endmodule
```

Bad code:

```vhdl
library ieee;
use ieee.std_logic_1164.all;

entity lock_control is
    port (
        clk      : in  std_logic;
        reset    : in  std_logic;
        lock     : in  std_logic;
        unlock   : in  std_logic;
        unlocked : out std_logic
    );
end entity lock_control;

architecture behavioral of lock_control is
    signal unlocked_reg  : std_logic:=’0’;
    signal unlocked_next : std_logic;
begin

    process(lock, unlock, unlocked_reg)
    begin
        if reset = '1' then
            unlocked_next <= '1';
        elsif lock = '1' then
            unlocked_next <= '0';
        elsif unlock = '1' then
            unlocked_next <= '1';
        else
            unlocked_next <= unlocked_reg;
        end if;
    end process;

    process(clk)
    begin
        if rising_edge(clk) then
            unlocked_reg <= unlocked_next;
        end if;
    end process;

    unlocked <= unlocked_reg;

end architecture behavioral;
```

Good code:

```algorithm
For combinational logic, ensure that simulation is triggered by every signal read by the block. This can be done by listing both inputs explicitly, but this is not recommended.
A safer and more maintainable approach is to use (in Verilog) always @*, which tells the simulator to include all signals used inside the block. In SystemVerilog, use always_comb. In VHDL use process(all).
```

### Example 2

A hardware developer is debugging logic which requires the system to be in an unprotected mode. In order to enable their work, they have (temporarily) removed some code related to the "protected\_mode\_enabled" flag in a way that does not cause the simulations to fail.

Bad code:

```vhdl
-- The following VHDL example is written for VHDL-93 or later.
signal secure     : boolean; -- implicitly initialized to ‘false’
signal policy_ok  : boolean;
signal lock_ready : boolean;
...
-- synthesis translate_off
secure <= security_check(policy_ok, lock_ready); -- TODO: restore this after debugging
-- synthesis translate_on
protected_mode_enabled <= secure;
```

Bad code:

```verilog
reg secure;
wire policy_ok;
wire lock_ready;
wire protected_mode_enabled;
...
always @(*) begin
    secure = 1'b0; // default value
    // synopsys translate_off
    secure = security_check(policy_ok, lock_ready); // TODO: restore this after debugging
    // synopsys translate_on
end
assign protected_mode_enabled = secure;
```

Good code:

```algorithm
Do not place security-relevant assignments inside synthesis-excluded regions. Any logic that affects protected-mode behavior should be represented consistently in both simulation and synthesis.
Limit synthesis translate_off / translate_on regions to simulation-only code that cannot assign, modify, override, or mask security-sensitive signals.
Carefully review all uses of translate_on/off directives. Ensure that developers can efficiently authorize their activities during development work, to avoid the temptation to bypass security features in this way.
```

Good code:

```vhdl
-- The following VHDL example is written for VHDL-93 or later.
signal secure     : boolean; -- implicitly initialized to ‘false’
signal policy_ok  : boolean;
signal lock_ready : boolean;
...
secure <= security_check(policy_ok, lock_ready);
protected_mode_enabled <= secure;
```

Good code:

```verilog
reg secure;
wire policy_ok;
wire lock_ready;
wire protected_mode_enabled;
...
always @(*) begin
    secure = security_check(policy_ok, lock_ready);
end
assign protected_mode_enabled = secure;
```

### Example 3

A hardware developer is designing a controller that manages whether protected configuration registers can be written. The controller includes states for reset handling, user-level operation, and privileged operation.

Bad code:

```vhdl
-- The following VHDL example is written for VHDL-93 or later.
type t_priv_state is (RESET, USER_ONLY, PRIVILEGED);
signal priv_state       : t_priv_state := RESET;
signal auth_passed      : boolean := false;
signal privilege_revoke : boolean := false;
...
process(clk, reset_n)
begin
    if reset_n = '0' then
        priv_state <= RESET;
    elsif rising_edge(clk) then
        case priv_state is
            when RESET =>
                priv_state <= USER_ONLY;
            when USER_ONLY =>
                if auth_passed then
                    priv_state <= PRIVILEGED;
                end if;
            when PRIVILEGED =>
                if privilege_revoke then
                    priv_state <= USER_ONLY;
                end if;
            when others =>
                priv_state <= USER_ONLY; -- intended recovery for unexpected encodings
            end case;
        end if;
    end process;
    protected_cfg_write_en <= (priv_state = PRIVILEGED);
```

Bad code:

```verilog
localparam RESET      = 2'b00;
localparam USER_ONLY  = 2'b01;
localparam PRIVILEGED = 2'b10;
reg [1:0] priv_state    = RESET;
wire      auth_passed;       // Implicitly 1-bit (boolean equivalent)
wire      privilege_revoke;  // Implicitly 1-bit (boolean equivalent)
wire      clk;
wire      reset_n;
wire      protected_cfg_write_en;
...
always @(posedge clk or negedge reset_n) begin
    if (!reset_n) begin
        priv_state <= RESET;
    end else begin
        case (priv_state)
            RESET: begin
                priv_state <= USER_ONLY;
            end

            USER_ONLY: begin
                if (auth_passed) begin
                    priv_state <= PRIVILEGED;
                end
            end

            PRIVILEGED: begin
                if (privilege_revoke) begin
                    priv_state <= USER_ONLY;
                end
            end

            default: begin
                priv_state <= USER_ONLY; // intended recovery for unexpected encodings
            end
        endcase
    end
end
assign protected_cfg_write_en = (priv_state == PRIVILEGED);
```

Good code:

```algorithm
Do not rely on a VHDL others choice or Verilog default branch to guarantee post-synthesis recovery behavior for security-critical state machines. If recovery from unexpected state encodings affects access to protected configuration registers, the implementation should not depend on synthesis inferring and preserving that behavior from RTL alone.
For this type of security-critical controller, implement the state machine using a carefully-controlled structural or hand-synthesized representation where the relevant state elements, reset behavior, transition logic, and fail-closed recovery behavior are explicit. Be careful that the synthesiser does not infer a state machine from the crafted logic, and “undo” the work. Review the resulting gate-level or structural implementation to confirm that unintended encodings are handled as required.
Perform post-synthesis simulations where faults are injected into the state registers and confirm the behavior.
Perform formal analysis to prove that the behavior of these critical blocks has not been altered by the synthesis process.
After the implementation is verified and validated, preserve it during integration so later synthesis or whole-design optimization does not re-encode, merge, remove, or otherwise transform the security-critical recovery logic.
This approach is costly and design-specific, but it is appropriate when relying on ordinary RTL synthesis would create unacceptable security risk.
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2025-51678 | The synthesized netlist incorrectly calculates memory addresses and fetches co-processor instructions, potentially causing unintended memory accesses or incorrect custom-instruction execution. |
| CVE-2025-51677 | Debug-load requests should return complete load store unit (LSU) data, but the synthesized netlist returned incomplete data, potentially causing incorrect interpretation of memory state. |
| CVE-2025-51679 | Instruction execution should update program-counter state correctly, but the synthesized netlist produced incomplete or undefined updates, potentially causing unintended control flow. |
| CVE-2025-51675 | The program counter should update when the next-program-counter value changes, but the synthesized netlist allowed stale PC state, potentially causing incorrect instruction fetches or stalls. |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-435](https://radicalnotion.ai/cwe/cwe-435) | Improper Interaction Between Multiple Correctly-Behaving Entities |

## Frequently asked questions

### What is CWE-1461?

The hardware design contains structures that are interpreted differently during synthesis than during simulation, which cause inconsistencies in security-relevant behavior between the synthesized implementation and the simulation.

### How do you prevent CWE-1461?

Establish and enforce HDL coding and review practices that minimize differences between simulation semantics and synthesis interpretation. Avoid HDL constructs, synthesis directives, and tool-dependent behaviors known to cause simulation/synthesis mismatch, with particular attention to security-relevant logic.

### How is CWE-1461 detected?

Automated Static Analysis - Source Code: HDL linting, rule-based static analysis, and HDL checker tools can examine source code for structures that may be interpreted differently by simulation and synthesis tools. They may identify synthesis-sensitive coding patterns associated with this weakness.

### What are the consequences of CWE-1461?

Exploiting CWE-1461 can lead to: Varies by Context.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/1461.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-1461). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
