Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating AMS example #567

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hw/ip_examples/ams/ams.core
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ filesets:
- rtl/ams_reg_pkg.sv
- rtl/ams_reg_top.sv
- rtl/ams.sv
- "!ams_sim? (rtl/dummy_adc.sv)"
- "!ams_sim? (rtl/dummy_myinverter.sv)"
file_type: systemVerilogSource

targets:
Expand Down
94 changes: 0 additions & 94 deletions hw/ip_examples/ams/analog/adc.sp

This file was deleted.

6 changes: 3 additions & 3 deletions hw/ip_examples/ams/analog/control.init
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

choose xa ../../../hw/ip_examples/ams/analog/adc.sp;
port_connect -cell ams_adc_1b ( vdd => vdd , gnd => gnd );
port_dir -cell ams_adc_1b (input sel; output out);
choose xa ../../../hw/ip_examples/ams/analog/myinverter.sp;
port_connect -cell myinverter ( vdd => vdd , gnd => gnd );
port_dir -cell myinverter (input a; output z);
bus_format <%d>;
22 changes: 22 additions & 0 deletions hw/ip_examples/ams/analog/myinverter.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
** Copyright EPFL contributors.
** Licensed under the Apache License, Version 2.0, see LICENSE for details.
** SPDX-License-Identifier: Apache-2.0

** Uses the 65nm_bulk PTM Bulk CMOS model, February 22, 2006 release
** (obtained from https://ptm.asu.edu)

v_vdd VDD 0 1.8
v_gnd VSS 0 0
.global VDD VSS

*Model Description
.param temp=27

*Include model file
.lib "/scrap/users/schiavon/gitdir/skywater-pdk/libraries/sky130_fd_pr/latest/models/sky130.lib.spice" tt

*d g s b
.SUBCKT myinverter a z VDD VSS
X1 z a VDD VDD sky130_fd_pr__pfet_01v8 w =0.84 l = 0.15
X2 z a VSS VSS sky130_fd_pr__nfet_01v8 w =0.36 l = 0.15
.ENDS myinverter
2 changes: 1 addition & 1 deletion hw/ip_examples/ams/data/ams.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "1:0", name:"VALUE", desc: "Set the ADC threshold value" }
{ bits: "0", name:"VALUE", desc: "Set the ADC threshold value" }
]
},
{ name: "GET",
Expand Down
6 changes: 3 additions & 3 deletions hw/ip_examples/ams/rtl/ams.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ module ams #(

assign hw2reg.get.de = 1;

ams_adc_1b ams_adc_1b_i (
.sel(reg2hw.sel.q),
.out(hw2reg.get.d)
myinverter myinverter_i (
.a(reg2hw.sel.q),
.z(hw2reg.get.d)
);

ams_reg_top #(
Expand Down
4 changes: 2 additions & 2 deletions hw/ip_examples/ams/rtl/ams_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package ams_reg_pkg;
// Typedefs for registers //
////////////////////////////

typedef struct packed {logic [1:0] q;} ams_reg2hw_sel_reg_t;
typedef struct packed {logic q;} ams_reg2hw_sel_reg_t;

typedef struct packed {logic q;} ams_reg2hw_get_reg_t;

Expand All @@ -24,7 +24,7 @@ package ams_reg_pkg;

// Register -> HW type
typedef struct packed {
ams_reg2hw_sel_reg_t sel; // [2:1]
ams_reg2hw_sel_reg_t sel; // [1:1]
ams_reg2hw_get_reg_t get; // [0:0]
} ams_reg2hw_t;

Expand Down
12 changes: 6 additions & 6 deletions hw/ip_examples/ams/rtl/ams_reg_top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ module ams_reg_top #(
// Define SW related signals
// Format: <reg>_<field>_{wd|we|qs}
// or <reg>_{wd|we|qs} if field == 1 or 0
logic [1:0] sel_qs;
logic [1:0] sel_wd;
logic sel_qs;
logic sel_wd;
logic sel_we;
logic get_qs;

// Register instances
// R[sel]: V(False)

prim_subreg #(
.DW (2),
.DW (1),
.SWACCESS("RW"),
.RESVAL (2'h0)
.RESVAL (1'h0)
) u_sel (
.clk_i (clk_i),
.rst_ni(rst_ni),
Expand Down Expand Up @@ -146,14 +146,14 @@ module ams_reg_top #(
end

assign sel_we = addr_hit[0] & reg_we & !reg_error;
assign sel_wd = reg_wdata[1:0];
assign sel_wd = reg_wdata[0];

// Read data return
always_comb begin
reg_rdata_next = '0;
unique case (1'b1)
addr_hit[0]: begin
reg_rdata_next[1:0] = sel_qs;
reg_rdata_next[0] = sel_qs;
end

addr_hit[1]: begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

module ams_adc_1b (
input logic [1:0] sel,
output logic out
module myinverter (
input logic a,
output logic z
);

endmodule : ams_adc_1b
endmodule : myinverter

Loading