Hi all, 1. Is it possible to use analog_io[7] to a...
# shuttle
m
Hi all, 1. Is it possible to use analog_io[7] to analog_io[10] in my design for up to 3.3v input (from port 8th to 10th) or output (7th port)? 2. If the answer of question #1 is yes then, how can I simulate the design using these analog ports? Do I have to create simulation and testbench for this design?
Here’s the Verilog code of the wrapper:
Copy code
module user_project_wrapper #(
    parameter BITS = 32
) (
`ifdef USE_POWER_PINS
    inout vdda1,	// User area 1 3.3V supply
    inout vdda2,	// User area 2 3.3V supply
    inout vssa1,	// User area 1 analog ground
    inout vssa2,	// User area 2 analog ground
    inout vccd1,	// User area 1 1.8V supply
    inout vccd2,	// User area 2 1.8v supply
    inout vssd1,	// User area 1 digital ground
    inout vssd2,	// User area 2 digital ground
`endif

    // Wishbone Slave ports (WB MI A)
    input wb_clk_i,
    input wb_rst_i,
    input wbs_stb_i,
    input wbs_cyc_i,
    input wbs_we_i,
    input [3:0] wbs_sel_i,
    input [31:0] wbs_dat_i,
    input [31:0] wbs_adr_i,
    output wbs_ack_o,
    output [31:0] wbs_dat_o,

    // Logic Analyzer Signals
    input  [127:0] la_data_in,
    output [127:0] la_data_out,
    input  [127:0] la_oenb,

    // IOs
    input  [`MPRJ_IO_PADS-1:0] io_in,
    output [`MPRJ_IO_PADS-1:0] io_out,
    output [`MPRJ_IO_PADS-1:0] io_oeb,

    // Analog (direct connection to GPIO pad---use with caution)
    // Note that analog I/O is not available on the 7 lowest-numbered
    // GPIO pads, and so the analog_io indexing is offset from the
    // GPIO indexing by 7 (also upper 2 GPIOs do not have analog_io).
    inout [`MPRJ_IO_PADS-10:0] analog_io,

    // Independent clock (on independent integer divider)
    input   user_clock2,

    // User maskable interrupt signals
    output [2:0] user_irq
);

/*--------------------------------------*/
/* User project is instantiated  here   */
/*--------------------------------------*/

wire [9:0] CORE_to_DAC_DATA;
wire PLL_to_CORE_CLK;

avsddac dac (
`ifdef USE_POWER_PINS
	.vccd1(vccd1),	// User area 1 1.8V power
	.vssd1(vssd1),	// User area 1 digital ground
`endif
    .OUT(analog_io[7]),
    .D(CORE_to_DAC_DATA),
    .VREFH(analog_io[8]),
    .VREFL(analog_io[9])
);

avsdpll pll (
`ifdef USE_POWER_PINS
	.vccd1(vccd1),	// User area 1 1.8V power
	.vssd1(vssd1),	// User area 1 digital ground
`endif
    .CLK(PLL_to_CORE_CLK),
    .VCO_IN(analog_io[10]),
    .ENb_CP(wbs_sel_i[1]),
    .ENb_VCO(wbs_sel_i[0]),
    .REF(wb_clk_i)
);

user_proj_example mprj (
`ifdef USE_POWER_PINS
	.vccd1(vccd1),	// User area 1 1.8V power
	.vssd1(vssd1),	// User area 1 digital ground
`endif
    .OUT(CORE_to_DAC_DATA),
    .CLK(PLL_to_CORE_CLK),
    .reset(wb_rst_i),
);

endmodule	// user_project_wrapper

`default_nettype wire
@User I'm using Caravel for my mixed-signal design. Is it possible to simulate analog_io pins?
t
@User: I would recommend creating a "behavioral" model of the analog part of the circuit in verilog, like I did in the caravel_user_project_analog. Then simulate that with a program that configures the I/O to shut off the digital input and output buffers, so that the pad can be used for analog (up to 3.3V, with the VDDIO/VDDA supply LDO that will be provided on the test board). The management SoC program will have statements like
reg_mprj_io_15 = GPIO_MODE_USER_STD_ANALOG
to enable analog configuration, followed by toggling the transfer bit as is done in all of the testbenches in
verilog/dv/caravel/mgmt_soc/
. For analog simulation, you can assume that there is a 150-ohm resistor between
analog_io
and the pad.
m
@User Thanks Tim. Is it possible for me to use caravel_user_project_analog tests as the sample? Or are there any real samples to do so?
Also may I use analog_io 7 to 10 for my design as analog input and output?
t
Yes. Just be aware of the index offset, so
analog_io[7]
uses the same GPIO pin as
io_in[14]
, and so forth.
You can use the caravel_user_project_analog tests, but you need to be aware that there are differences in the pin names on the user wrapper cell vs. caravel_user_project.