SlideShare a Scribd company logo
--------------------------------------------------------------------------<br />-- Download and save file as mem_tb.vhd<br />-- AUB<br />-- EECE 321 - Computer Organization, Spring 2009<br />-- Author: M. M.<br />--------------------------------------------------------------------------<br />-- Description: Testbench for memory simulator<br />--------------------------------------------------------------------------<br />library ieee;<br />use ieee.std_logic_1164.all;<br />use ieee.std_logic_unsigned.all;<br />use ieee.std_logic_arith.all;<br />use ieee.std_logic_misc.all;<br />USE ieee.std_logic_textio.all;<br />USE std.textio.all;<br />LIBRARYwork;<br />USE work.auxiliary.all;<br />-- Dummy entity<br />ENTITY mem_tb is<br />END mem_tb;<br />-- Memory simulator architecture<br />ARCHITECTURE mem_tb of mem_tb is <br />-- input and output file name<br />CONSTANT in_fname  : STRING := quot;
..oem_input_file.txtquot;
;<br />CONSTANT out_fname : STRING := quot;
..oem_image_file.txtquot;
;<br />BEGIN<br />mem_behavior: process is<br />VARIABLE mem : MEM_ARRAY(0 to 63);<br />VARIABLE  word  : MIPS_WORD;<br />VARIABLE  data  : INTEGER;<br />BEGIN<br />-- initialize memory<br />init_mem(in_fname, mem);<br />-- load memory contents and print them<br />for i in mem'range loop<br />word := load_word(mem,4*i); -- note byte address<br />report quot;
word at byte address quot;
 & integer'image(i) & quot;
 = quot;
 & integer'image(conv_integer(word));<br />end loop;<br />-- perform some store operations<br />data := 16#22#;<br />word := conv_std_logic_vector(data,word'length); -- convert data into a 32-bit vector<br />store_word(mem,word,16#4#);<br />data := 16#33#;<br />word := conv_std_logic_vector(data,word'length); -- convert data into a 32-bit vector<br />store_word(mem,word,16#C#);<br />data := 16#44#;<br />word := conv_std_logic_vector(data,word'length); -- convert data into a 32-bit vector<br />store_word(mem,word,16#14#);<br />-- print new memory contents onto console<br />for i in mem'range loop<br />word := load_word(mem,4*i); -- note byte address<br />report quot;
word at byte address quot;
 & integer'image(i) & quot;
 = quot;
 & integer'image(conv_integer(word));<br />end loop;<br />-- copy contents of memory into an external file<br />copy_mem_2_file(out_fname, mem);<br />-- perform other memory functions<br />wait;<br />END process mem_behavior;<br />END mem_tb;<br />
Mem Tb
Mem Tb
Mem Tb

More Related Content

Similar to Mem Tb

第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習
第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習
第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習
Computational Materials Science Initiative
 
Manual & guide_for_birt_eclipse_report designer
Manual & guide_for_birt_eclipse_report designerManual & guide_for_birt_eclipse_report designer
Manual & guide_for_birt_eclipse_report designer
AASIM MAHMOOD
 
Manual & guide for birt eclipse report designer
Manual & guide for birt eclipse report designerManual & guide for birt eclipse report designer
Manual & guide for birt eclipse report designer
AASIM MAHMOOD
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuning
afa reg
 
Sweet fx readme
Sweet fx readmeSweet fx readme
Sweet fx readme
MLGGS
 

Similar to Mem Tb (20)

Ass hđh
Ass hđhAss hđh
Ass hđh
 
Quick reference for solr
Quick reference for solrQuick reference for solr
Quick reference for solr
 
第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習
第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習
第5回CCMSハンズオン(ソフトウェア講習会): AkaiKKRチュートリアル 2. AkaiKKRの実習
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuilding
 
Final Report
Final ReportFinal Report
Final Report
 
Manual & guide_for_birt_eclipse_report designer
Manual & guide_for_birt_eclipse_report designerManual & guide_for_birt_eclipse_report designer
Manual & guide_for_birt_eclipse_report designer
 
Manual & guide for birt eclipse report designer
Manual & guide for birt eclipse report designerManual & guide for birt eclipse report designer
Manual & guide for birt eclipse report designer
 
Pm800 userguide
Pm800 userguidePm800 userguide
Pm800 userguide
 
Privacy Policy - Color Wallpapers (Solid)
Privacy Policy - Color Wallpapers (Solid)Privacy Policy - Color Wallpapers (Solid)
Privacy Policy - Color Wallpapers (Solid)
 
Precision Bearing House, Industrial Automation | PBH
Precision Bearing House, Industrial Automation | PBHPrecision Bearing House, Industrial Automation | PBH
Precision Bearing House, Industrial Automation | PBH
 
MS-07 Jan June 2017
MS-07 Jan June 2017MS-07 Jan June 2017
MS-07 Jan June 2017
 
Using AWR/Statspack for Wait Analysis
Using AWR/Statspack for Wait AnalysisUsing AWR/Statspack for Wait Analysis
Using AWR/Statspack for Wait Analysis
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuning
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
aaaaHistory
aaaaHistoryaaaaHistory
aaaaHistory
 
Cs501 handouts 1_45-ilovepdf-compressed
Cs501 handouts 1_45-ilovepdf-compressedCs501 handouts 1_45-ilovepdf-compressed
Cs501 handouts 1_45-ilovepdf-compressed
 
Version 1.7
Version 1.7Version 1.7
Version 1.7
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogic
 
Data Storage
Data StorageData Storage
Data Storage
 
Sweet fx readme
Sweet fx readmeSweet fx readme
Sweet fx readme
 

More from ececourse

Machine Problem 2
Machine Problem 2Machine Problem 2
Machine Problem 2
ececourse
 
Machine Problem 1
Machine Problem 1Machine Problem 1
Machine Problem 1
ececourse
 
Chapter 2 Hw
Chapter 2 HwChapter 2 Hw
Chapter 2 Hw
ececourse
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 C
ececourse
 
C:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 BC:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 B
ececourse
 
Chapter 2 Part2 A
Chapter 2 Part2 AChapter 2 Part2 A
Chapter 2 Part2 A
ececourse
 
Chapter 2 Part1
Chapter 2 Part1Chapter 2 Part1
Chapter 2 Part1
ececourse
 

More from ececourse (14)

Chapter 5 c
Chapter 5 cChapter 5 c
Chapter 5 c
 
Chapter 5 b
Chapter 5  bChapter 5  b
Chapter 5 b
 
Chapter 5 a
Chapter 5 aChapter 5 a
Chapter 5 a
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Auxiliary
AuxiliaryAuxiliary
Auxiliary
 
Machine Problem 2
Machine Problem 2Machine Problem 2
Machine Problem 2
 
Machine Problem 1
Machine Problem 1Machine Problem 1
Machine Problem 1
 
Chapter 2 Hw
Chapter 2 HwChapter 2 Hw
Chapter 2 Hw
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 C
 
C:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 BC:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 B
 
Chapter 2 Part2 A
Chapter 2 Part2 AChapter 2 Part2 A
Chapter 2 Part2 A
 
Chapter1
Chapter1Chapter1
Chapter1
 
Chapter 2 Part1
Chapter 2 Part1Chapter 2 Part1
Chapter 2 Part1
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 

Mem Tb

  • 1. --------------------------------------------------------------------------<br />-- Download and save file as mem_tb.vhd<br />-- AUB<br />-- EECE 321 - Computer Organization, Spring 2009<br />-- Author: M. M.<br />--------------------------------------------------------------------------<br />-- Description: Testbench for memory simulator<br />--------------------------------------------------------------------------<br />library ieee;<br />use ieee.std_logic_1164.all;<br />use ieee.std_logic_unsigned.all;<br />use ieee.std_logic_arith.all;<br />use ieee.std_logic_misc.all;<br />USE ieee.std_logic_textio.all;<br />USE std.textio.all;<br />LIBRARYwork;<br />USE work.auxiliary.all;<br />-- Dummy entity<br />ENTITY mem_tb is<br />END mem_tb;<br />-- Memory simulator architecture<br />ARCHITECTURE mem_tb of mem_tb is <br />-- input and output file name<br />CONSTANT in_fname : STRING := quot; ..oem_input_file.txtquot; ;<br />CONSTANT out_fname : STRING := quot; ..oem_image_file.txtquot; ;<br />BEGIN<br />mem_behavior: process is<br />VARIABLE mem : MEM_ARRAY(0 to 63);<br />VARIABLE word : MIPS_WORD;<br />VARIABLE data : INTEGER;<br />BEGIN<br />-- initialize memory<br />init_mem(in_fname, mem);<br />-- load memory contents and print them<br />for i in mem'range loop<br />word := load_word(mem,4*i); -- note byte address<br />report quot; word at byte address quot; & integer'image(i) & quot; = quot; & integer'image(conv_integer(word));<br />end loop;<br />-- perform some store operations<br />data := 16#22#;<br />word := conv_std_logic_vector(data,word'length); -- convert data into a 32-bit vector<br />store_word(mem,word,16#4#);<br />data := 16#33#;<br />word := conv_std_logic_vector(data,word'length); -- convert data into a 32-bit vector<br />store_word(mem,word,16#C#);<br />data := 16#44#;<br />word := conv_std_logic_vector(data,word'length); -- convert data into a 32-bit vector<br />store_word(mem,word,16#14#);<br />-- print new memory contents onto console<br />for i in mem'range loop<br />word := load_word(mem,4*i); -- note byte address<br />report quot; word at byte address quot; & integer'image(i) & quot; = quot; & integer'image(conv_integer(word));<br />end loop;<br />-- copy contents of memory into an external file<br />copy_mem_2_file(out_fname, mem);<br />-- perform other memory functions<br />wait;<br />END process mem_behavior;<br />END mem_tb;<br />