Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
fix: add (* keep_hierarchy *) attribute to cells
Browse files Browse the repository at this point in the history
This makes the physical design closer to the source Wokwi design, and prevents yosys from optimizing things like inverter loops (ring oscillators).
  • Loading branch information
urish authored Nov 6, 2024
1 parent 7a2cd7d commit 0c973fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cells.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ It's only needed for Wokwi designs.

`define default_netname none

(* keep_hierarchy *)
module buffer_cell (
input wire in,
output wire out
);
assign out = in;
endmodule

(* keep_hierarchy *)
module and_cell (
input wire a,
input wire b,
Expand All @@ -22,6 +24,7 @@ module and_cell (
assign out = a & b;
endmodule

(* keep_hierarchy *)
module or_cell (
input wire a,
input wire b,
Expand All @@ -31,6 +34,7 @@ module or_cell (
assign out = a | b;
endmodule

(* keep_hierarchy *)
module xor_cell (
input wire a,
input wire b,
Expand All @@ -40,6 +44,7 @@ module xor_cell (
assign out = a ^ b;
endmodule

(* keep_hierarchy *)
module nand_cell (
input wire a,
input wire b,
Expand All @@ -49,6 +54,7 @@ module nand_cell (
assign out = !(a&b);
endmodule

(* keep_hierarchy *)
module not_cell (
input wire in,
output wire out
Expand All @@ -57,6 +63,7 @@ module not_cell (
assign out = !in;
endmodule

(* keep_hierarchy *)
module mux_cell (
input wire a,
input wire b,
Expand All @@ -67,6 +74,7 @@ module mux_cell (
assign out = sel ? b : a;
endmodule

(* keep_hierarchy *)
module dff_cell (
input wire clk,
input wire d,
Expand All @@ -80,6 +88,7 @@ module dff_cell (

endmodule

(* keep_hierarchy *)
module dffsr_cell (
input wire clk,
input wire d,
Expand Down

0 comments on commit 0c973fd

Please sign in to comment.