blob: d318fba1fdc9a49c6325e33013ee267d8be11dff [file] [log] [blame]
Tim Edwardsa44a60b2021-04-28 14:05:41 -04001// SPDX-FileCopyrightText: 2020 Efabless Corporation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// SPDX-License-Identifier: Apache-2.0
15
16`default_nettype none
17`timescale 1 ns / 1 ps
18
19// This is just a copy of simple_por.v from the Caravel project, used
20// as an analog user project example.
21
22module example_por(
23`ifdef USE_POWER_PINS
24 inout vdd3v3,
25 inout vdd1v8,
26 inout vss,
27`endif
28 output porb_h,
29 output porb_l,
30 output por_l
31);
32
33 wire mid, porb_h;
34 reg inode;
35
36 // This is a behavioral model! Actual circuit is a resitor dumping
37 // current (slowly) from vdd3v3 onto a capacitor, and this fed into
38 // two schmitt triggers for strong hysteresis/glitch tolerance.
39
40 initial begin
41 inode <= 1'b0;
42 end
43
44 // Emulate current source on capacitor as a 500ns delay either up or
45 // down. Note that this is sped way up for verilog simulation; the
46 // actual circuit is set to a 15ms delay.
47
48 always @(posedge vdd3v3) begin
49 #500 inode <= 1'b1;
50 end
51 always @(negedge vdd3v3) begin
52 #500 inode <= 1'b0;
53 end
54
55 // Instantiate two shmitt trigger buffers in series
56
57 sky130_fd_sc_hvl__schmittbuf_1 hystbuf1 (
58`ifdef USE_POWER_PINS
59 .VPWR(vdd3v3),
60 .VGND(vss),
61 .VPB(vdd3v3),
62 .VNB(vss),
63`endif
64 .A(inode),
65 .X(mid)
66 );
67
68 sky130_fd_sc_hvl__schmittbuf_1 hystbuf2 (
69`ifdef USE_POWER_PINS
70 .VPWR(vdd3v3),
71 .VGND(vss),
72 .VPB(vdd3v3),
73 .VNB(vss),
74`endif
75 .A(mid),
76 .X(porb_h)
77 );
78
79 sky130_fd_sc_hvl__lsbufhv2lv_1 porb_level (
80`ifdef USE_POWER_PINS
81 .VPWR(vdd3v3),
82 .VPB(vdd3v3),
83 .LVPWR(vdd1v8),
84 .VNB(vss),
85 .VGND(vss),
86`endif
87 .A(porb_h),
88 .X(porb_l)
89 );
90
91 // since this is behavioral anyway, but this should be
92 // replaced by a proper inverter
93 assign por_l = ~porb_l;
94endmodule
95`default_nettype wire