Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
142 views
6 pages
LIFO 16x8 RAM
Uploaded by
Cregan
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Download
Save
Save LIFO_16x8_RAM For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
142 views
6 pages
LIFO 16x8 RAM
Uploaded by
Cregan
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save LIFO_16x8_RAM For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save LIFO_16x8_RAM For Later
You are on page 1
/ 6
Search
Fullscreen
Gopu Krishnan G
BPRN 12
Q. Write a RTL and a task-based test bench for the 16x8
last-in-first-out RAM memory
1 module LIFO_16x8(
2 input clock, resetn,
3 input write_enb, read_enb,
4 input [7:0] data_in,
5 output full, empty,
6 output reg [7:0] data_out
7 );
8 reg [4:0] wr_ptr, rd_ptr;
9 reg [7:0] lifo [15:0];
10 integer i;
11
12 always @(posedge clock)
13 begin
14 if (!resetn) begin
15 for(i = 0; i < 16; i = i + 1) begin
16 lifo[i] <= 8'd0;
17 end
18 wr_ptr <= 5'd0;
19 end
20 else if (write_enb && !full) begin
21 lifo[wr_ptr] <= data_in;
22 wr_ptr <= (wr_ptr + 1'b1);
23 end
24 end
25
26 always @(posedge clock)
27 begin
28 if (!resetn) begin
29 data_out <= 8'd0;
30 rd_ptr <= 5'd15;
31 end
32 else if (read_enb && !empty) begin
33 data_out <= lifo[rd_ptr];
34 rd_ptr <= (rd_ptr - 1'b1);
35 end
36 end
37
38 assign full = (wr_ptr == ~rd_ptr) ? 1'b1 : 1'b0;
39 //assign full = (wr_ptr == 5'b10000 && rd_ptr == 5'b01111) ? 1'b1 : 1'b0;
40
41 assign empty = (wr_ptr == {rd_ptr[4], ~rd_ptr[3:0]}) ? 1'b1 : 1'b0;
42 //assign empty = (wr_ptr == 5'b00000 && rd_ptr == 5'b01111)||(wr_ptr == 5'b10000 && rd_ptr == 5'b11111) ? 1'b1:1'b0;
43
44 endmodule
1 module LIFO_16x8_tb;
2 reg clk, resetn, write_enb, read_enb;
3 reg [7:0] data_in;
4 wire full, empty;
5 wire [7:0] data_out;
6 integer i;
7
8 LIFO_16x8 DUT (
9 .clock(clk),
10 .resetn(resetn),
11 .write_enb(write_enb),
12 .read_enb(read_enb),
13 .data_in(data_in),
14 .full(full),
15 .empty(empty),
16 .data_out(data_out)
17 );
18
19 initial begin
20 clk = 1'b0;
21 forever #5 clk = ~clk;
22 end
23
24 task reset();
25 begin
26 @(negedge clk);
27 resetn = 1'b0;
28 @(negedge clk);
29 resetn = 1'b1;
30 end
31 endtask
32
33 task initialize();
34 begin
35 write_enb = 1'b0;
36 read_enb = 1'b0;
37 resetn = 1'b1;
38 data_in = 8'd0;
39 end
40 endtask
41
42 task write(input [7:0]data);
43 begin
44 @(negedge clk);
45 write_enb = 1'b1;
46 read_enb = 1'b0;
47 data_in = data;
48 end
49 endtask
50
51 task delay();
52 begin
53 #10;
54 end
55 endtask
56
57 task read();
58 begin
59 @(negedge clk);
60 write_enb = 1'b0;
61 read_enb = 1'b1;
62 end
63 endtask
64
65 initial begin
66 initialize;
67 reset;
68 delay;
69 for(i = 0; i < 16; i = i + 1)
70 begin
71 write({$random} % 256);
72 end
73 read;
74 @(negedge clk);
75 wait(empty);
76 delay;
77 $finish;
78 end
79
80 initial begin
81 $monitor("data_out = %0h, full = %b, empty = %b, write_enb = %b, read_enb = %b, wr_ptr = %d, rd_ptr = %d",
82 data_out, full, empty, write_enb, read_enb, DUT.wr_ptr, DUT.rd_ptr);
83 end
84 endmodule
You might also like
Sakshi Router Project
PDF
No ratings yet
Sakshi Router Project
17 pages
SV Assertion PART - 1
PDF
No ratings yet
SV Assertion PART - 1
5 pages
System Verilog Short Notes
PDF
100% (1)
System Verilog Short Notes
22 pages
Types of TestBench and Fork Join
PDF
No ratings yet
Types of TestBench and Fork Join
46 pages
Final Test - B98
PDF
No ratings yet
Final Test - B98
4 pages
100002-Verilog MASS Question February 2023
PDF
No ratings yet
100002-Verilog MASS Question February 2023
5 pages
Pcie Config Space Interview Questions.
PDF
No ratings yet
Pcie Config Space Interview Questions.
4 pages
Test 35
PDF
No ratings yet
Test 35
6 pages
Apbuvm
PDF
No ratings yet
Apbuvm
48 pages
Cache Controller Verilog Project
PDF
No ratings yet
Cache Controller Verilog Project
4 pages
Ibex Documentation: Release 0.1.dev50+g36ce999.d20191026
PDF
No ratings yet
Ibex Documentation: Release 0.1.dev50+g36ce999.d20191026
53 pages
Dual-Port Memory Block Diagram
PDF
No ratings yet
Dual-Port Memory Block Diagram
8 pages
Final Test 101
PDF
No ratings yet
Final Test 101
4 pages
UVM Interview Questions
PDF
No ratings yet
UVM Interview Questions
5 pages
SystemVerilog Assertions Basics
PDF
No ratings yet
SystemVerilog Assertions Basics
13 pages
Dual Port Ram Using Uvm
PDF
No ratings yet
Dual Port Ram Using Uvm
42 pages
UART Using System Verilog
PDF
No ratings yet
UART Using System Verilog
4 pages
VLSI Lab Manual
PDF
No ratings yet
VLSI Lab Manual
117 pages
Verilog
PDF
No ratings yet
Verilog
6 pages
Mod-12 Loadable Up - Down Counter
PDF
No ratings yet
Mod-12 Loadable Up - Down Counter
14 pages
Verilog Interview Question
PDF
No ratings yet
Verilog Interview Question
8 pages
Assertions Examples
PDF
No ratings yet
Assertions Examples
6 pages
Apb Interview Question
PDF
No ratings yet
Apb Interview Question
4 pages
Ahb Faq
PDF
No ratings yet
Ahb Faq
18 pages
Quiz - Docx - Verilog
PDF
No ratings yet
Quiz - Docx - Verilog
5 pages
SV Assertion Part2
PDF
No ratings yet
SV Assertion Part2
5 pages
Lab 5
PDF
0% (1)
Lab 5
23 pages
8 - Test Bench System Verilog
PDF
No ratings yet
8 - Test Bench System Verilog
38 pages
The English Tutor (Seale, Sara)
PDF
No ratings yet
The English Tutor (Seale, Sara)
281 pages
All VerilogLabs
PDF
No ratings yet
All VerilogLabs
74 pages
System Verilog Interview Questions
PDF
No ratings yet
System Verilog Interview Questions
8 pages
Lab 6
PDF
No ratings yet
Lab 6
9 pages
Blocking Non Blocking
PDF
No ratings yet
Blocking Non Blocking
3 pages
Ahb2ap Bridge
PDF
100% (1)
Ahb2ap Bridge
3 pages
Verilog Tutorial For Beginners
PDF
No ratings yet
Verilog Tutorial For Beginners
4 pages
LAB 3 Report
PDF
No ratings yet
LAB 3 Report
10 pages
Verilog Tips and Interview Questions - Verilog
PDF
No ratings yet
Verilog Tips and Interview Questions - Verilog
8 pages
Uvm Fifo
PDF
No ratings yet
Uvm Fifo
35 pages
Verilog Weekly Quiz 1 - : Questions Right Wrong Unattended Accuracy Time Taken
PDF
No ratings yet
Verilog Weekly Quiz 1 - : Questions Right Wrong Unattended Accuracy Time Taken
28 pages
Single Port Ram Synchronous Read Write
PDF
No ratings yet
Single Port Ram Synchronous Read Write
2 pages
Synchronous FIFO
PDF
No ratings yet
Synchronous FIFO
4 pages
Experiment 10: Aim:-Verilog Implementation of Clock Divider Software Used
PDF
No ratings yet
Experiment 10: Aim:-Verilog Implementation of Clock Divider Software Used
6 pages
Aquabolt-XL: Samsung HBM2-PIM With In-Memory Processing For ML Accelerators and Beyond
PDF
No ratings yet
Aquabolt-XL: Samsung HBM2-PIM With In-Memory Processing For ML Accelerators and Beyond
26 pages
Sample Testplan-AXI DRIVER
PDF
No ratings yet
Sample Testplan-AXI DRIVER
13 pages
Apb Code
PDF
No ratings yet
Apb Code
25 pages
Design and Verification of AMBA AHB
PDF
No ratings yet
Design and Verification of AMBA AHB
6 pages
Dbms Practical File
PDF
No ratings yet
Dbms Practical File
29 pages
Implementing Communication Bridge Between I2C and APB
PDF
No ratings yet
Implementing Communication Bridge Between I2C and APB
4 pages
Verilog Parameters and Operators
PDF
No ratings yet
Verilog Parameters and Operators
25 pages
Fifo Verilog Code
PDF
No ratings yet
Fifo Verilog Code
2 pages
Verilog Tutorial
PDF
No ratings yet
Verilog Tutorial
92 pages
User Manual Cadence Digital
PDF
No ratings yet
User Manual Cadence Digital
5 pages
Amba Specification Advanced Extensible Interface Bus (Axi)
PDF
No ratings yet
Amba Specification Advanced Extensible Interface Bus (Axi)
37 pages
Ver I Log Examples
PDF
No ratings yet
Ver I Log Examples
22 pages
APB
PDF
No ratings yet
APB
29 pages
Xge Mac Spec
PDF
100% (1)
Xge Mac Spec
24 pages
Class 12 Topics
PDF
No ratings yet
Class 12 Topics
43 pages
Logic Circuits Midterm Reviewer
PDF
No ratings yet
Logic Circuits Midterm Reviewer
38 pages
Sync and Asyc FIFO
PDF
No ratings yet
Sync and Asyc FIFO
3 pages
Assignment Solution Week3
PDF
No ratings yet
Assignment Solution Week3
3 pages
Class 6 English Holiday Homework 2024-2025
PDF
No ratings yet
Class 6 English Holiday Homework 2024-2025
6 pages
Verilog HDL: Module
PDF
No ratings yet
Verilog HDL: Module
9 pages
Solaris Command Reference
PDF
100% (12)
Solaris Command Reference
7 pages
Parker Hyd Motor
PDF
No ratings yet
Parker Hyd Motor
44 pages
Quest For The Centre of The Old Testamen
PDF
No ratings yet
Quest For The Centre of The Old Testamen
14 pages
Past Progressive Story 3 (Past Continuous) : Really
PDF
100% (1)
Past Progressive Story 3 (Past Continuous) : Really
8 pages
MPU 1223 - Presentation Skills
PDF
No ratings yet
MPU 1223 - Presentation Skills
48 pages
SailPoint Active Directory Connector Guide
PDF
No ratings yet
SailPoint Active Directory Connector Guide
114 pages
CHUYÊN ĐỀ 17 Adverbial Clauses
PDF
No ratings yet
CHUYÊN ĐỀ 17 Adverbial Clauses
13 pages
ControlLogix Controller Portfolio Customer Presentation
PDF
No ratings yet
ControlLogix Controller Portfolio Customer Presentation
22 pages
Do The Exercises Below On The Simple Past Tense and Click On The Button To Check Your Answers. The Simple Past Tense
PDF
No ratings yet
Do The Exercises Below On The Simple Past Tense and Click On The Button To Check Your Answers. The Simple Past Tense
18 pages
Medio P213 - User Guide v1-0 PDF
PDF
No ratings yet
Medio P213 - User Guide v1-0 PDF
34 pages
A Conversation-Driven Approach For Chatbot Management: Presented By: Naheeda Afreen 19B81A3325
PDF
No ratings yet
A Conversation-Driven Approach For Chatbot Management: Presented By: Naheeda Afreen 19B81A3325
19 pages
Grammar, Vocabulary, and Pronunciation: Grammar 1 Complete The Sentences With Will / 'LL or Won't and A Verb
PDF
100% (1)
Grammar, Vocabulary, and Pronunciation: Grammar 1 Complete The Sentences With Will / 'LL or Won't and A Verb
4 pages
Ahmed Messlmani: Skills Work Experience
PDF
No ratings yet
Ahmed Messlmani: Skills Work Experience
1 page
Unit - V: Principles of HDL
PDF
No ratings yet
Unit - V: Principles of HDL
56 pages
Team 3 Kubernetes MinIO WS2021
PDF
No ratings yet
Team 3 Kubernetes MinIO WS2021
34 pages
6.4.5 Packet Tracer - Configure Static NAT
PDF
No ratings yet
6.4.5 Packet Tracer - Configure Static NAT
2 pages
Elsc 109 Module 1 - Fbadua
PDF
No ratings yet
Elsc 109 Module 1 - Fbadua
27 pages
Ankitseth SAP Basis
PDF
No ratings yet
Ankitseth SAP Basis
2 pages
Professional Foundations - Week 7 Milestone Rubric
PDF
No ratings yet
Professional Foundations - Week 7 Milestone Rubric
6 pages
RPS Bhs Arab 2 Ekos 18 - 19
PDF
No ratings yet
RPS Bhs Arab 2 Ekos 18 - 19
5 pages
Notes CFG
PDF
No ratings yet
Notes CFG
25 pages
Week 2
PDF
No ratings yet
Week 2
30 pages
Jackson Intercom Article
PDF
No ratings yet
Jackson Intercom Article
2 pages
Unleashing The Power of ChatGPT For Translation
PDF
No ratings yet
Unleashing The Power of ChatGPT For Translation
10 pages
Essay - A Portrait of A Lady On Fire
PDF
No ratings yet
Essay - A Portrait of A Lady On Fire
4 pages
Analytical Exposition
PDF
No ratings yet
Analytical Exposition
20 pages
Audio Lectures
PDF
No ratings yet
Audio Lectures
2 pages
Application-Specific Integrated Circuit ASIC A Complete Guide
From Everand
Application-Specific Integrated Circuit ASIC A Complete Guide
Gerardus Blokdyk
No ratings yet