blob: 7fef90db6191224c0f9bc19430ac3baf815a80c3 [file] [log] [blame]
Matt Venn08cd6eb2020-11-16 12:01:14 +01001`default_nettype none
Tim Edwards21a9aac2020-10-12 22:05:18 -04002`timescale 1 ns / 1 ps
3
Tim Edwardsf51dd082020-10-05 16:30:24 -04004module simple_por(
Ahmed Ghazy27200e92020-11-25 22:07:02 +02005`ifdef USE_POWER_PINS
Ahmed Ghazy69663c72020-11-18 20:15:53 +02006 inout vdd3v3,
7 inout vdd1v8,
8 inout vss,
Ahmed Ghazy27200e92020-11-25 22:07:02 +02009`endif
Ahmed Ghazy69663c72020-11-18 20:15:53 +020010 output porb_h,
11 output porb_l,
12 output por_l
Tim Edwardsf51dd082020-10-05 16:30:24 -040013);
14
15 wire mid, porb_h;
16 reg inode;
17
18 // This is a behavioral model! Actual circuit is a resitor dumping
19 // current (slowly) from vdd3v3 onto a capacitor, and this fed into
20 // two schmitt triggers for strong hysteresis/glitch tolerance.
21
22 initial begin
Tim Edwards21a9aac2020-10-12 22:05:18 -040023 inode <= 1'b0;
Tim Edwardsf51dd082020-10-05 16:30:24 -040024 end
25
26 // Emulate current source on capacitor as a 500ns delay either up or
Tim Edwards10708322020-11-20 13:55:57 -050027 // down. Note that this is sped way up for verilog simulation; the
28 // actual circuit is set to a 15ms delay.
Tim Edwardsf51dd082020-10-05 16:30:24 -040029
30 always @(posedge vdd3v3) begin
31 #500 inode <= 1'b1;
32 end
33 always @(negedge vdd3v3) begin
34 #500 inode <= 1'b0;
35 end
36
37 // Instantiate two shmitt trigger buffers in series
38
Ahmed Ghazy69663c72020-11-18 20:15:53 +020039 sky130_fd_sc_hvl__schmittbuf_1 hystbuf1 (
40`ifdef USE_POWER_PINS
Tim Edwardsf51dd082020-10-05 16:30:24 -040041 .VPWR(vdd3v3),
42 .VGND(vss),
43 .VPB(vdd3v3),
44 .VNB(vss),
Ahmed Ghazy69663c72020-11-18 20:15:53 +020045`endif
Tim Edwardsf51dd082020-10-05 16:30:24 -040046 .A(inode),
47 .X(mid)
48 );
49
Ahmed Ghazy69663c72020-11-18 20:15:53 +020050 sky130_fd_sc_hvl__schmittbuf_1 hystbuf2 (
51`ifdef USE_POWER_PINS
Tim Edwardsf51dd082020-10-05 16:30:24 -040052 .VPWR(vdd3v3),
53 .VGND(vss),
54 .VPB(vdd3v3),
55 .VNB(vss),
Ahmed Ghazy69663c72020-11-18 20:15:53 +020056`endif
Tim Edwardsf51dd082020-10-05 16:30:24 -040057 .A(mid),
58 .X(porb_h)
59 );
60
Ahmed Ghazy69663c72020-11-18 20:15:53 +020061 sky130_fd_sc_hvl__lsbufhv2lv_1 porb_level (
62`ifdef USE_POWER_PINS
63 .VPWR(vdd3v3),
64 .VPB(vdd3v3),
65 .LVPWR(vdd1v8),
66 .VNB(vss),
67 .VGND(vss),
68`endif
69 .A(porb_h),
70 .X(porb_l)
71 );
72
73 // since this is behavioral anyway, but this should be
74 // replaced by a proper inverter
Tim Edwards581068f2020-11-19 12:45:25 -050075 assign por_l = ~porb_l;
Tim Edwardsf51dd082020-10-05 16:30:24 -040076endmodule
Tim Edwards581068f2020-11-19 12:45:25 -050077`default_nettype wire