Build a four-input NOR as a pseudo-NMOS gate: four switches pull down and one weak, always-on switch pulls up.
Hardware context: A wide NOR match line of a lookup table built as a pseudo-NMOS gate. Build a wide NOR without a long PMOS stack.
The match line of a small lookup table must be a NOR of four bits. A static CMOS NOR4 needs four PMOS in series. The design team wants a pseudo-NMOS gate instead.
This is an Implement problem. Build pnor4 from the cells of switches.sv. A pseudo-NMOS gate has one NMOS per input and one always-on PMOS load. Five transistors at most.
The check reads the value and the strength of y after every row. When any input is 1, y must be a strong 0. When all inputs are 0, y must be a pull-strength 1 from the weak load.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
rows | 32 | input of each check |
Full specification
module pnor4 (
input logic a,
input logic b,
input logic c,
input logic d,
output wire y
);
supply1 vdd; // the positive supply: always 1
supply0 gnd; // ground: always 0
// your transistors
endmodule
| Inputs | y | Strength |
|---|---|---|
| all 0 | 1 | pull (Pu1): only the load drives y |
| any input 1 | 0 | strong (St0): the NMOS beat the load |
// switches.sv: the transistor cells (read-only). Terminals are (out, in, ctrl).
// Each cell adds 1 to the transistor counter of the check when the simulation starts.
module nfet (output wire out, input wire in, input wire ctrl); nmos (out, in, ctrl); initial tb.transistors++; endmodule // on when ctrl is 1
module pfet (output wire out, input wire in, input wire ctrl); pmos (out, in, ctrl); initial tb.transistors++; endmodule // on when ctrl is 0
module rpfet (output wire out, input wire in, input wire ctrl); rpmos (out, in, ctrl); initial tb.transistors++; endmodule // on when ctrl is 0; weak: passes a 1 at pull strength
| Rule | Detail |
|---|---|
| Transistors | Only nfet, pfet and rpfet cells, five at most. |
| Supplies | vdd is always 1 and gnd is always 0. They are declared for you. |
| Result | y after each of eight input rows, as a value with its strength. Then the transistors over the budget, which must be 0. |
Examples
Example 1
Rows 0000 to 0111- Input
(a, b, c, d) = 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111
- Output
y_row1 = 1 (pull, Pu1) (1), y_row2 = 0 (strong, St0) (0), y_row3 = 0 (strong, St0) (0), y_row4 = 0 (strong, St0) (0), y_row5 = 0 (strong, St0) (0), y_row6 = 0 (strong, St0) (0), y_row7 = 0 (strong, St0) (0), y_row8 = 0 (strong, St0) (0), transistors_over_budget = 0, built_from_switch_cells = yes (1)
Only the first row has every input at 0, so only it gives the weak 1 of the load. Every other row has an NMOS on and gives a strong 0.
Example 2
One Input at a Time- Input
(a, b, c, d) = 0000, 1000, 0000, 0100, 0000, 0010, 0000, 0001
- Output
y_row1 = 1 (pull, Pu1) (1), y_row2 = 0 (strong, St0) (0), y_row3 = 1 (pull, Pu1) (1), y_row4 = 0 (strong, St0) (0), y_row5 = 1 (pull, Pu1) (1), y_row6 = 0 (strong, St0) (0), y_row7 = 1 (pull, Pu1) (1), y_row8 = 0 (strong, St0) (0), transistors_over_budget = 0, built_from_switch_cells = yes (1)
Each of the four NMOS alone is enough to pull y to a strong 0. Between them, with all inputs at 0, the load brings y back to a pull 1.
Example 3
All Inputs High, Then Low- Input
(a, b, c, d) = 1111, 0000, 1111, 0000, 0011, 0000, 1100, 0000
- Output
y_row1 = 0 (strong, St0) (0), y_row2 = 1 (pull, Pu1) (1), y_row3 = 0 (strong, St0) (0), y_row4 = 1 (pull, Pu1) (1), y_row5 = 0 (strong, St0) (0), y_row6 = 1 (pull, Pu1) (1), y_row7 = 0 (strong, St0) (0), y_row8 = 1 (pull, Pu1) (1), transistors_over_budget = 0, built_from_switch_cells = yes (1)
Four NMOS on at once give the same strong 0 as one. The level in silicon is lower, but strength has only these steps.
Constraints and Contract
- Inputs are known 0/1 values; each row is held for one nanosecond and y is read at its end.
- Keep the module name, the ports and the supply nets vdd and gnd.
Hints
Hint 1
The pull-down network of a NOR is one NMOS per input, all in parallel between y and gnd.
Hint 2
The load must always be on, so its gate goes to a fixed net. Which one turns a PMOS on?
Hint 3
Two equally strong drivers that disagree give x. The load must be weaker than the NMOS: use the resistive cell.
What the grader checks: Four directed and four seeded scripts apply eight input rows each. After every row the value and strength of y are compared with the function computed in JavaScript. The cells are counted. Switch-level strengths stand in for widths: the low level in volts and the static current are measured in lesson G9.10, not here.
9 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 1 steps and the final capstone