Important Instructions:: Verification Using System Verilog
Important Instructions:: Verification Using System Verilog
Important Instructions:
1) All assignment results should be computer screenshot or computer typed. Handwritten and
scanned copies shall not be considered for evaluation
2) Due date for all assignment submission is 1 Week from the last date of internship
3) All assignment questions should be captured along with solutions/answers.
4) Code snippets, simulation results should be captured properly
5) Use only the JPEG image format for capturing the simulation results and name/label the results
appropriately.
6) The description of answers should be short and crisp. Provide only the required information,
answered copied or cut and pasted from google shall not be considered.
USER SPACE
2. APB MEMORY
`timescale 1ns/1ps
`define DATAWIDTH 32
`define ADDRWIDTH 8
module APB_Slave(
input PCLK,
input PRESETn,
input PWRITE,
input PSEL,
if (PRESETn == 0) begin
PRDATA <= 0;
PREADY <= 0;
end
else begin
case (State)
`IDLE : begin
PRDATA <= 0;
if (PSEL) begin
if (PWRITE) begin
end
else begin
end
end
end
`W_ENABLE : begin
PREADY <=1;
end
end
`R_ENABLE : begin
PREADY <= 1;
end
end
default: begin
end
endcase end
end
endmodule
`timescale 1ns/1ps
`define DATAWIDTH 32
`define ADDRWIDTH 8
reg PCLK;
reg PRESETn;
reg PWRITE;
reg PSEL;
wire PREADY;
integer i;
integer j;
initial begin
$dumpfile("dump.vcd");
$dumpvars(1,APB_Slave_tb);
PCLK = 0;
PRESETn = 0;
#10
PRESETn = 1;
PSEL = 0;
Write;
Read;
#20;
#10000;
$finish;
end
APB_Slave DUT(PCLK,
PRESETn,
PADDR,
PWRITE,
PSEL,
PWDATA,
PRDATA,
PREADY );
task Write;
begin
// #1;
PSEL = 1;
PWRITE = 1;
PADDR = i;
PWDATA = i;
end
// #2;
// PSEL = 0;
end
// PSEL = 0;
end
endtask
task Read;
begin
PSEL = 1;
PWRITE = 0;
// end
PADDR = j;
// PSEL = 0;
// end
end
end
end
endtask
endmodule