Skip to content
Open
Show file tree
Hide file tree
Changes from 14 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
1 change: 1 addition & 0 deletions config/derivlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,7 @@ GPIO_SUPPORTED 0
UART_SUPPORTED 0
PLIC_SUPPORTED 0
SPI_SUPPORTED 0
PWM_SUPPORTED 0

deriv sv39 rv64gc
SV48_SUPPORTED 0
Expand Down
4 changes: 4 additions & 0 deletions config/rv32e/config.vh
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ localparam logic [63:0] SDC_RANGE = 64'h00000FFF;
localparam logic SPI_SUPPORTED = 0;
localparam logic [63:0] SPI_BASE = 64'h10040000;
localparam logic [63:0] SPI_RANGE = 64'h00000FFF;
localparam logic PWM_SUPPORTED = 0;
localparam logic [63:0] PWM_BASE = 64'h10020000;
localparam logic [63:0] PWM_RANGE = 64'h000000FF;

// Bus Interface width
localparam AHBW = (XLEN);
Expand All @@ -211,6 +214,7 @@ localparam PLIC_GPIO_ID = 32'd3;
localparam PLIC_UART_ID = 32'd10;
localparam PLIC_SPI_ID = 32'd6;
localparam PLIC_SDC_ID = 32'd9;
localparam PLIC_PWM_ID = 32'd7;

// Branch prediction
localparam logic BPRED_SUPPORTED = 0;
Expand Down
4 changes: 4 additions & 0 deletions config/rv32gc/config.vh
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ localparam logic [63:0] SDC_RANGE = 64'h00000FFF;
localparam logic SPI_SUPPORTED = 1;
localparam logic [63:0] SPI_BASE = 64'h10040000;
localparam logic [63:0] SPI_RANGE = 64'h00000FFF;
localparam logic PWM_SUPPORTED = 1;
localparam logic [63:0] PWM_BASE = 64'h10020000;
localparam logic [63:0] PWM_RANGE = 64'h000000FF;

// Bus Interface width
localparam AHBW = (XLEN);
Expand All @@ -213,6 +216,7 @@ localparam PLIC_GPIO_ID = 32'd3;
localparam PLIC_UART_ID = 32'd10;
localparam PLIC_SPI_ID = 32'd6;
localparam PLIC_SDC_ID = 32'd9;
localparam PLIC_PWM_ID = 32'd7;

// Branch prediction
localparam logic BPRED_SUPPORTED = 1;
Expand Down
4 changes: 4 additions & 0 deletions config/rv32i/config.vh
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ localparam logic [63:0] SDC_RANGE = 64'h00000FFF;
localparam logic SPI_SUPPORTED = 0;
localparam logic [63:0] SPI_BASE = 64'h10040000;
localparam logic [63:0] SPI_RANGE = 64'h00000FFF;
localparam logic PWM_SUPPORTED = 0;
localparam logic [63:0] PWM_BASE = 64'h10020000;
localparam logic [63:0] PWM_RANGE = 64'h000000FF;

// Bus Interface width
localparam AHBW = (XLEN);
Expand All @@ -211,6 +214,7 @@ localparam PLIC_GPIO_ID = 32'd3;
localparam PLIC_UART_ID = 32'd10;
localparam PLIC_SPI_ID = 32'd6;
localparam PLIC_SDC_ID = 32'd9;
localparam PLIC_PWM_ID = 32'd7;

// Branch prediction
localparam logic BPRED_SUPPORTED = 0;
Expand Down
4 changes: 4 additions & 0 deletions config/rv32imc/config.vh
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ localparam logic [63:0] SDC_RANGE = 64'h00000FFF;
localparam logic SPI_SUPPORTED = 1;
localparam logic [63:0] SPI_BASE = 64'h10040000;
localparam logic [63:0] SPI_RANGE = 64'h00000FFF;
localparam logic PWM_SUPPORTED = 1;
localparam logic [63:0] PWM_BASE = 64'h10020000;
localparam logic [63:0] PWM_RANGE = 64'h000000FF;

// Bus Interface width
localparam AHBW = (XLEN);
Expand All @@ -211,6 +214,7 @@ localparam PLIC_GPIO_ID = 32'd3;
localparam PLIC_UART_ID = 32'd10;
localparam PLIC_SPI_ID = 32'd6;
localparam PLIC_SDC_ID = 32'd9;
localparam PLIC_PWM_ID = 32'd7;

// Branch prediction
localparam logic BPRED_SUPPORTED = 0;
Expand Down
4 changes: 4 additions & 0 deletions config/rv64gc/config.vh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ localparam logic [63:0] SDC_RANGE = 64'h00000FFF;
localparam logic SPI_SUPPORTED = 1;
localparam logic [63:0] SPI_BASE = 64'h10040000;
localparam logic [63:0] SPI_RANGE = 64'h00000FFF;
localparam logic PWM_SUPPORTED = 1;
localparam logic [63:0] PWM_BASE = 64'h10020000;
localparam logic [63:0] PWM_RANGE = 64'h000000FF;

// Bus Interface width
localparam AHBW = (XLEN);
Expand All @@ -214,6 +217,7 @@ localparam PLIC_GPIO_ID = 32'd3;
localparam PLIC_UART_ID = 32'd10;
localparam PLIC_SPI_ID = 32'd6;
localparam PLIC_SDC_ID = 32'd9;
localparam PLIC_PWM_ID = 32'd7;

// Branch prediction
localparam logic BPRED_SUPPORTED = 1;
Expand Down
4 changes: 4 additions & 0 deletions config/rv64i/config.vh
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ localparam logic [63:0] SDC_RANGE = 64'h00000FFF;
localparam logic SPI_SUPPORTED = 0;
localparam logic [63:0] SPI_BASE = 64'h10040000;
localparam logic [63:0] SPI_RANGE = 64'h00000FFF;
localparam logic PWM_SUPPORTED = 0;
localparam logic [63:0] PWM_BASE = 64'h10020000;
localparam logic [63:0] PWM_RANGE = 64'h000000FF;

// Bus Interface width
localparam AHBW = (XLEN);
Expand All @@ -210,6 +213,7 @@ localparam PLIC_GPIO_ID = 32'd3;
localparam PLIC_UART_ID = 32'd10;
localparam PLIC_SPI_ID = 32'd6;
localparam PLIC_SDC_ID = 32'd9;
localparam PLIC_PWM_ID = 32'd7;

// Branch prediction
localparam logic BPRED_SUPPORTED = 0;
Expand Down
4 changes: 4 additions & 0 deletions config/shared/parameter-defs.vh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ localparam cvw_t P = '{
SPI_SUPPORTED : SPI_SUPPORTED,
SPI_BASE : SPI_BASE,
SPI_RANGE : SPI_RANGE,
PWM_SUPPORTED : PWM_SUPPORTED,
PWM_BASE : PWM_BASE,
PWM_RANGE : PWM_RANGE,
GPIO_LOOPBACK_TEST : GPIO_LOOPBACK_TEST,
SPI_LOOPBACK_TEST : SPI_LOOPBACK_TEST,
UART_PRESCALE : UART_PRESCALE ,
Expand All @@ -99,6 +102,7 @@ localparam cvw_t P = '{
PLIC_UART_ID : PLIC_UART_ID,
PLIC_SPI_ID : PLIC_SPI_ID,
PLIC_SDC_ID : PLIC_SDC_ID,
PLIC_PWM_ID : PLIC_PWM_ID,
BPRED_SUPPORTED : BPRED_SUPPORTED,
BPRED_TYPE : BPRED_TYPE,
BPRED_SIZE : BPRED_SIZE,
Expand Down
36 changes: 36 additions & 0 deletions sim/questa/wave-pwm.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
onerror {resume}
quietly virtual signal -install /testbench/dut/core/ifu/bpred/bpred { /testbench/dut/core/ifu/bpred/bpred/PostSpillInstrRawF[11:7]} rd
quietly WaveActivateNextPane {} 0
add wave -noupdate /testbench/clk
add wave -noupdate /testbench/reset
add wave -noupdate /testbench/memfilename
add wave -noupdate /testbench/dut/core/PCE
add wave -noupdate /testbench/dut/core/ieu/dp/regf/rf
add wave -noupdate -label MCYCLE -radix unsigned {/testbench/dut/core/priv/priv/csr/counters/counters/HPMCOUNTER_REGW[0]}
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMCompareIP
add wave -noupdate /testbench/dut/uncoregen/uncore/gpio/gpio/high_ip
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMCount
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMScaled
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMCompare0
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMDeglitchMux
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMCompareXNOR
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMCompareBoolean
add wave -noupdate /testbench/dut/uncoregen/uncore/pwm/pwm/PWMCompareIPIn
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 4} {89834 ns} 1} {{Cursor 4} {79055 ns} 1} {{Cursor 3} {89604 ns} 0}
quietly wave cursor active 3
configure wave -namecolwidth 250
configure wave -valuecolwidth 194
configure wave -justifyvalue left
configure wave -signalnamewidth 1
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ns
update
WaveRestoreZoom {89564 ns} {89776 ns}
5 changes: 5 additions & 0 deletions src/cvw.sv
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ typedef struct packed {
logic SPI_SUPPORTED;
logic [63:0] SPI_BASE;
logic [63:0] SPI_RANGE;
logic PWM_SUPPORTED;
logic [63:0] PWM_BASE;
logic [63:0] PWM_RANGE;


// Test modes

Expand All @@ -162,6 +166,7 @@ typedef struct packed {
int PLIC_UART_ID;
int PLIC_SPI_ID;
int PLIC_SDC_ID;
int PLIC_PWM_ID;

logic BPRED_SUPPORTED;
logic [31:0] BPRED_TYPE;
Expand Down
5 changes: 3 additions & 2 deletions src/mmu/adrdecs.sv
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module adrdecs import cvw::*; #(parameter cvw_t P) (
input logic [P.PA_BITS-1:0] PhysicalAddress,
input logic AccessRW, AccessRX, AccessRWXC,
input logic [1:0] Size,
output logic [11:0] SelRegions
output logic [12:0] SelRegions
);

localparam logic [3:0] SUPPORTED_SIZE = (P.LLEN == 32 ? 4'b0111 : 4'b1111);
Expand All @@ -49,8 +49,9 @@ module adrdecs import cvw::*; #(parameter cvw_t P) (
adrdec #(P.PA_BITS) plicdec(PhysicalAddress, P.PLIC_BASE[P.PA_BITS-1:0], P.PLIC_RANGE[P.PA_BITS-1:0], P.PLIC_SUPPORTED, AccessRW, Size, 4'b0100, SelRegions[9]);
adrdec #(P.PA_BITS) sdcdec(PhysicalAddress, P.SDC_BASE[P.PA_BITS-1:0], P.SDC_RANGE[P.PA_BITS-1:0], P.SDC_SUPPORTED, AccessRW, Size, SUPPORTED_SIZE & 4'b1100, SelRegions[10]);
adrdec #(P.PA_BITS) spidec(PhysicalAddress, P.SPI_BASE[P.PA_BITS-1:0], P.SPI_RANGE[P.PA_BITS-1:0], P.SPI_SUPPORTED, AccessRW, Size, 4'b0100, SelRegions[11]);
adrdec #(P.PA_BITS) pwmdec(PhysicalAddress, P.PWM_BASE[P.PA_BITS-1:0], P.PWM_RANGE[P.PA_BITS-1:0], P.PWM_SUPPORTED, AccessRW, Size, 4'b0100, SelRegions[12]);

assign SelRegions[0] = ~|(SelRegions[11:1]); // none of the regions are selected
assign SelRegions[0] = ~|(SelRegions[12:1]); // none of the regions are selected
endmodule

// verilator lint_on UNOPTFLAT
2 changes: 1 addition & 1 deletion src/mmu/pmachecker.sv
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module pmachecker import cvw::*; #(parameter cvw_t P) (

logic PMAAccessFault;
logic AccessRW, AccessRWXC, AccessRX;
logic [11:0] SelRegions;
logic [12:0] SelRegions;
logic AtomicAllowed;
logic CacheableRegion, IdempotentRegion;

Expand Down
5 changes: 3 additions & 2 deletions src/uncore/plic_apb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module plic_apb import cvw::*; #(parameter cvw_t P) (
input logic PENABLE,
output logic [P.XLEN-1:0] PRDATA,
output logic PREADY,
input logic UARTIntr,GPIOIntr, SPIIntr, SDCIntr,
input logic UARTIntr,GPIOIntr, SPIIntr, SDCIntr, PWMIntr,
output logic MExtInt, SExtInt
);

Expand Down Expand Up @@ -177,8 +177,9 @@ module plic_apb import cvw::*; #(parameter cvw_t P) (
requests = {P.PLIC_NUM_SRC{1'b0}};
if(P.PLIC_GPIO_ID != 0) requests[P.PLIC_GPIO_ID] = GPIOIntr;
if(P.PLIC_UART_ID != 0) requests[P.PLIC_UART_ID] = UARTIntr;
if(P.PLIC_SPI_ID != 0) requests[P.PLIC_SPI_ID] = SPIIntr;
if(P.PLIC_SPI_ID != 0) requests[P.PLIC_SPI_ID] = SPIIntr;
if(P.PLIC_SDC_ID !=0) requests[P.PLIC_SDC_ID] = SDCIntr;
if(P.PLIC_PWM_ID != 0) requests[P.PLIC_PWM_ID] = PWMIntr;
end

// pending interrupt request
Expand Down
Loading