Ritesh Vlsi Report (Project 2)
Ritesh Vlsi Report (Project 2)
USN : 1KS21EC076
College Name: K S INSTITUTE OF TECHNOLOGY
Department: E&C
Date of Submission: 13/03/2025
1. Introduction
This report presents the RTL design and functional verification of an 8-bit Shift Register using Verilog. The shifter is
capable of shifting an 8-bit input either to the left or right by a specified number of bits (N), based on control inputs.
The implementation was verified using EDA Playground and synthesized using FPGA/ASIC tools
Block Diagram:
3. RTL Code
// Code your design here
input[7:0] data_in,
input[2:0] shift_amount,
input direction,
);
always@(posedge clk)
begin
if(rst==1)
data_out <= 0;
else
if(direction==0)
else
end
endmodule
4. Testbench Code
// or browse Examples
module shift_tb;
reg clk,rst;
reg direction;
wire[7:0] data_out;
data_in,
shift_amount,
direction,
data_out);
always #5 clk=~clk;
initial
begin
clk=1;
rst=1;
#10;
rst =0;
data_in = 8'b00110011;
shift_amount = 3'b010;
data_in= 8'b00110011;
shift_amount =3'b010;
#10;
data_in= 8'b11010010;
shift_amount=3'b011;
#10;
data_in= 8'b11010010;
shift_amount=3'b011;
#10;
$finish;
end
initial
begin
$dumpfile("dump.vcd");
$dumpvars;
end
endmodule
Simulation & Verification
Testbench Setup:
Input values are provided for data_in, shift_amount, and direction.
data_out is observed and compared with expected values.
Multiple test cases are used to verify functionality.
Expected Output:
Input (data_in) Shift (shift_amount) Direction (direction) Output (data_out)
10101010 1 Left 01010100
10101010 2 Right 00101010
11001100 3 Left 01100000
11001100 4 Right 00001100
The design was simulated in Aldec Riviera-PRO. The waveform confirmed correct sum
and carry-out values for different test cases.
The 8-bit Shifter was successfully implemented and verified. The simulation results matched the expected behavior,
confirming the correctness of the design. The design was analyzed for power, area, and timing constraints, and it met
the required specifications.
Evaluation Criteria for Block-Level Verification in UVM
● Driver
endfunction
endfunction: build_phase
/* repeat(2) begin
item=shifter_8bit_sequence_item::type_id::create("item");
seq_item_port.get_next_item(item);
init_drive(item);
//item.print();
seq_item_port.item_done();
end
*/
forever begin
// item=shifter_8bit_sequence_item::type_id::create("item");
this.item = uvm_object_registry#(shifter_8bit_sequence_item,
"shifter_8bit_sequence_item")::create("item", /* parent = null */, /* contxt = "\000" */);
//this.s_item = uvm_object_registry#(shifter_8bit_sequence_item,
"shifter_8bit_sequence_item")::create("s_item", /* parent = null */, /* contxt = "\000" */);
seq_item_port.get_next_item(item);
drive(item);
//item.print();
seq_item_port.item_done();
end
endtask
// vif.A<=item.A;
// vif.B<=item.B;
vif.data_in = item.data_in;
vif.shift_amount = item.shift_amount;
vif.shift_direction = item.shift_direction;
// vif.valid=item.valid;
// vif.AgreaterthanB=item.AgreaterthanB;
// vif.AlessthanB=item.AlessthanB;
// vif.AequaltoB=item.AequaltoB;
endtask
/*
task init_drive(shifter_8bit_sequence_item item);
`uvm_info(get_name(),"Init Drive...",UVM_HIGH)
//vif.rst=item.rst;
@(posedge vif.clk);
vif.a<=item.a;
vif.b<=item.b;
endtask
*/
endclass: shifter_8bit_driver
● Monitor
mon_port=new("mon_port",this);
endfunction: build_phase
sample(item);
`uvm_info(get_name(),"Item received!!",UVM_HIGH)
mon_port.write(item);
end
endtask
// item.rst=vif.rst;
// @(negedge vif.rdy);
@(posedge vif.clk);
// #1;
item.data_in = vif.data_in;
item.shift_amount = vif.shift_amount;
item.shift_direction = vif.shift_direction;
item.expected_data_out = (item.shift_direction == 0) ? (item.data_in << item.shift_amount) :
(item.data_in >> item.shift_amount);
item.data_out = vif.data_out;
// item.A = vif.A;
// item.B = vif.B;
// item.result = vif.result;
// item.exception = vif.exception;
// item.overflow = vif.overflow;
// item.underflow = vif.underflow;
// item.done = vif.done;
// @(posedge vif.clk);
endtask
endclass: shifter_8bit_monitor
● Agent
drv=shifter_8bit_driver::type_id::create("drv",this);
mon=shifter_8bit_monitor::type_id::create("mon",this);
seqr=shifter_8bit_sequencer::type_id::create("seqr",this);
endfunction: build_phase
endclass: shifter_8bit_agent
● Environment
shifter_8bit_agent agent;
shifter_8bit_scoreboard scb;
// shifter_8bit_coverage cov_subscriber; // Declare the coverage subscriber
● Test
class shifter_8bit_test extends uvm_test;
`uvm_component_utils(shifter_8bit_test)
shifter_8bit_env env;
// shifter_8bit_main_seq main_seq;
phase.raise_objection(this);
// repeat(`TEST_COUNT) begin
// main_seq=shifter_8bit_main_seq::type_id::create("main_seq");class shifter_8bit_test extends
uvm_test;
`uvm_component_utils(shifter_8bit_test)
shifter_8bit_env env;
// shifter_8bit_main_seq main_seq;
phase.raise_objection(this);
// repeat(`TEST_COUNT) begin
// main_seq=shifter_8bit_main_seq::type_id::create("main_seq");
// main_seq.start(env.agent.seqr);
// end
wait(env.scb.test_cnt==`TEST_COUNT);
phase.drop_objection(this);
endtask
*/
endclass: shifter_8bit_test
// shifter_8bit_env env;
shifter_8bit_mul_seq mul_seq;
phase.raise_objection(this);
repeat(`TEST_COUNT) begin
// forever begin
mul_seq=shifter_8bit_mul_seq::type_id::create("mul_seq");
mul_seq.start(env.agent.seqr);
end
wait(env.scb.test_cnt==`TEST_COUNT);
phase.drop_objection(this);
endtask
endclass: shifter_8bit_mul_test
● Testbench
`include "interface.sv"
`include "sequence_items.sv"
`include "sequencer.sv"
`include "sequence.sv"
`include "driver.sv"
`include "monitor.sv"
`include "scoreboard.sv"
`include "agent.sv"
`include "environment.sv"
`include "test.sv"
module top;
bit clk=0;
// bit rst;
shifter_8bit_if top_if(clk);
shifter_8bit dut(
.data_in (top_if.data_in),
.shift_amount (top_if.shift_amount),
.shift_direction (top_if.shift_direction),
.data_out (top_if.data_out )
);
//clock generation
initial forever #0.5 clk=~clk;
initial begin
// rst = 1;
// #2 rst =0;
end
initial begin
uvm_config_db #(virtual shifter_8bit_if) :: set(null,"*","shifter_8bit_vif",top_if);
`uvm_info("TOP","Configured database for interface...",UVM_LOW)
end
initial begin
run_test("shifter_8bit_test");
end
initial begin
$dumpfile("waveform.vcd");
$dumpvars;
end
endmodule
2. Stimulus Generation (15%)
● Sequence Item
/*module shifter_8bit (
input [7:0] data_in, // 8-bit input data
input [2:0] shift_amount, // Shift amount (0 to 7)
input shift_direction, // Shift direction (0: left, 1: right)
output [7:0] data_out // 8-bit shifted output
);
reg [7:0] shifted_data; // Temporary register to hold shifted data
*/
//`uvm_object_utils_begin(shifter_8bit_sequence_item)
// `uvm_field_int(A, UVM_ALL_ON)
// `uvm_field_int(B, UVM_ALL_ON)
// `uvm_field_int(result, UVM_ALL_ON)
// `uvm_object_utils_end
endclass
● Sequence
class shifter_8bit_base_sequence extends uvm_sequence;
`uvm_object_utils(shifter_8bit_base_sequence)
shifter_8bit_sequence_item shifter_8bit_item;
endclass: shifter_8bit_base_sequence
`uvm_object_utils(shifter_8bit_mul_seq)
shifter_8bit_sequence_item item;
task body();
`uvm_info(get_name(),"Running main sequence...",UVM_HIGH);
// item=shifter_8bit_sequence_item::type_id::create("item");
this.item = uvm_object_registry#(shifter_8bit_sequence_item,
"shifter_8bit_sequence_item")::create("item", /* parent = null */, /* contxt = "\000" */);
//this.s_item = uvm_object_registry#(shifter_8bit_sequence_item,
"shifter_8bit_sequence_item")::create("s_item", /* parent = null */, /* contxt = "\000" */);
start_item(item);
item.randomize();
// rst == 1'b0; };
finish_item(item);
endtask
endclass
3. Scoreboarding and Checking (25%)
● Scoreboard
shifter_8bit_sequence_item item[$];
shifter_8bit_sequence_item s_item;
int test_cnt=0;
int test_valid=0;
int test_invalid=0;
endfunction: new
endfunction: build_phase
endfunction: connect_phase
this.s_item = uvm_object_registry#(shifter_8bit_sequence_item,
"shifter_8bit_sequence_item")::create("s_item", /* parent = null */, /* contxt = "\000" */);
wait((item.size() != 0));
s_item=item.pop_front();
// s_item.print();
compare(s_item);
test_cnt++;
end
endtask
endfunction
endclass
4. Debugging and Logs (5%)
● interface
endinterface: shifter_8bit_if
● Waveform (In Testbench)
initial
begin
$dumpfile("dump.vcd");
$dumpvars();
end
5. Code Quality and Best Practices (5%)
In this section, the layout of the RTL code has been generated using the OpenROAD software
tool.
#export EQUIVALENCE_CHECK ?= 0
#export REMOVE_CELLS_FOR_EQY = sky130_fd_sc_hd tapvpwrvgnd*
#export FASTROUTE_TCL =
$(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NICKNAME)/fastroute.tcl
#export REMOVE_ABC_BUFFERS = 1
Instructions of the constraint.sdc
current_design shifter_8bit
Power Measurement:
Area Measurement:
(Path is unconstrained)
Generated GDS
Conclusions
In this report, the RTL code of 8-bit shift register has been designed in verilog. The code is
successfully verified with the UVM with 100% test case pass. The design code is further processed
in the openROAD tool to generate its GDS using the gf180 platform. It has shown that the
generated layout consumes 155nW power which occupies 4662 sq. um area. There is no setup
and hold violations.