SlideShare una empresa de Scribd logo
1 de 3
Prof. A.B                           Department of Electrical and Computer Engineering                          Spring’10
                                          EECE 321 – Computer Organization

                           Project – Machine Problem 1: Modeling Memory in VHDL [10 points]

Throughout this semester, you will be working on your course project in pieces through a set of machine problems which
be released on a regular basis. At the end of the semester, you will assemble the blocks you designed in these machine
problems to implement a pipelined MIPS processor (more details to follow). So make sure you save your designs and
document them in order to use them later. Your final grade on the project will be the sum of the grades you accumulate on
the machine problems. All machine problems must be done using Modelsim version 6.5d. Follow the link on other
ECE section web site for more information.

In the first machine problem (MP1), you will learn how to model memory using VHDL. Please refer to the two VHDL
source files auxiliary.vhd and mem_tb.vhd that are provided along with MP1. The file auxiliary.vhd is a VHDL package
containing some user-defined constants, data types, functions, and procedures that you frequently need when performing
memory operations. You can add your own functions to this package as needed. The file mem_tb.vhd contains a test bench
for memory which you can use to experiment with.

The following is a description of the contents of these two files.

auxiliary.vhd:
    • MIPS_WORD_SIZE_IN_BYTES is a constant that refers to the number of BYTES within a WORD in MIPS.

    •    MIPS_WORD is a data type that models a 32-bit word in MIPS. It is basically a 32-bit std_logic_vector. To
         define a variable in VHDL of type MIPS_WORD, use
                  VARIABLE word : MIPS_WORD;
         The same applies for defining a signal in VHDL.

    •    MEM_ARRAY is a data type which models an array whose elements are MIPS_WORDs. To define a memory
         that contains 64 words, use
                  VARIABLE mem : MEM_ARRAY(1 to 64);

    •    The procedure init_mem initializes memory from an external input file. The format of the input file is as follows:

                  00000000     00000010
                  00000004     00000011
                  00000008     00000012
                  0000000c     00000013
                  …

         Each line contains two fields separated by a white space. The first field is an address in hex format. The address is
         composed of 8 hexadecimal digits. The second field contains the data corresponding to that address, again in
         hexadecimal. init_mem reads this file and initialize memory, writing the data at the corresponding locations, and
         filling zeros in all other locations that may not be specified in the input file.

    •    The procedure copy_mem_2_file does the opposite of init_mem. It takes a snapshot of memory and writes its
         contents into an external file, again in the same format defined above.

    •    The function load_word returns the contents of memory at some address in the form of a MIPS_WORD as
         defined above.

    •    The procedure store_word stores a word into memory at some address.

    •    The procedures read_hex_2_natural and read_hex_2_word are auxiliary functions used in parsing a line from a
         file and translating it from hexadecimal into a decimal number or a MIPS_WORD.
mem_tb.vhd:

    •   The file starts by loading some IEEE packages.
    •   Next, the auxiliary package defined above is loaded.
    •   A dummy entity is defined, followed by an architecture.
    •   The architecture contains one simple process which you can modify to perform various memory operations.
    •   A memory variable mem is defined within this process. The memory contains 64 MIPS words.
    •   Two constants are defined to provide paths to an input file used to initialize memory and output file used to take a
        snapshot of memory after performing some store operations.
    •   The statement init_mem(in_fname, mem) initializes memory from the input file specified by in_fname.
    •   The following loop loads the contents of memory one at a time and prints the contents to the output console (just
        for demonstration purposes).
    •   The next three sets of statements before the second loop perform three store operations to memory. Data 0x22 is
        written to address 0x4, data 0x33 is written to address 0xC, and data 0x44 is written to address 0x14. Note the
        syntax in VHDL how to specify literals in various bases:
             o Example:
                        12343               -- base 10 integer literal
                        2#10011110# -- base 2 (binary) integer literal
                        8#720#              -- base 8 (octal) integer literal
                        16#FFFF0ABC# -- base 16 (hex) integer literal

    •   The next for loop simply prints the new contents of memory onto the output console

    •   The statement copy_mem_2_file(out_fname, mem) prints the contents of memory into an external file.




Your tasks in this machine problem are:

    •   Understand the various functions and procedures defined in auxiliary.vhd and how they are used in mem_tb.vhd.

    •   Create a directory in your system called mp1. Under mp1, create three subdirectories: mti, src, io.
        Create a VHDL project called mp1.prj under mp1mti. Then, add all your VHDL source files (i.e., with
        extensions .vhd) under mp1src. Create a text file called mem_input_file.txt and save the data shown on the
        next page in this file. Save mem_input_file.txt under mp1io. Make sure you do not have white spaces at the
        end of the file.

    •   Modify mem_tb.vhd to create a memory that has 32 MIPS words. Initialize this memory from an external file
        whose format is as described above. Then sort the contents of memory in ascending order. The sorted data must
        then be written back to memory. The output file as a result of your simulation will automatically be written to
        mp1iomem_image_file.txt.

    •   Deliverables: The whole VHDL project directory.
            • mp1
                        • mti  includes mp1.prj
                        • src  includes all your source files
                        • io  includes all your input and output data files
Contents of mem_input_file.txt:

                                  00000000   0000a010
                                  00000004   00009111
                                  00000008   00000f12
                                  0000000c   00010013
                                  00000010   0000bb10
                                  00000014   0000c11c
                                  00000018   00000fee
                                  0000001c   0001fa13
                                  00000020   0000a7a8
                                  00000024   000012b4
                                  00000028   000044d5
                                  0000002c   0000ffcf
                                  00000030   00054a2a
                                  00000034   000431eb
                                  00000038   00032fec
                                  0000003c   000810ed
                                  00000040   0000a039
                                  00000044   000f9138
                                  00000048   00000f37
                                  0000004c   00010036
                                  00000050   0001a035
                                  00000054   00009124
                                  00000058   00010f03
                                  0000005c   00000002
                                  00000060   0001a021
                                  00000064   0001912a
                                  00000068   00010f2b
                                  0000006c   0000002c
                                  00000070   0002a0ed
                                  00000074   000391ee
                                  00000078   00040fef
                                  0000007c   000000e0

Más contenido relacionado

Similar a Machine Problem 1

Fundamentals of Physical Memory Analysis
Fundamentals of Physical Memory AnalysisFundamentals of Physical Memory Analysis
Fundamentals of Physical Memory AnalysisDmitry Vostokov
 
Fundamentals of Complete Crash and Hang Memory Dump Analysis
Fundamentals of Complete Crash and Hang Memory Dump AnalysisFundamentals of Complete Crash and Hang Memory Dump Analysis
Fundamentals of Complete Crash and Hang Memory Dump AnalysisDmitry Vostokov
 
06 - ELF format, knowing your friend
06 - ELF format, knowing your friend06 - ELF format, knowing your friend
06 - ELF format, knowing your friendAlexandre Moneger
 
International Burmese democratic forces and friends of Burma who
International Burmese democratic forces and friends of Burma who International Burmese democratic forces and friends of Burma who
International Burmese democratic forces and friends of Burma who Burma Democratic Concern (BDC)
 
Linux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewLinux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewRajKumar Rampelli
 
Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)
Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)
Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)Dmitry Vostokov
 
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeDEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeFelipe Prado
 
CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy
CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy
CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphymovocode
 
SANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry AnalysisSANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry Analysismooyix
 
Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0Cloudera, Inc.
 
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014Julien Le Dem
 
Microprocessor Week1: Introduction
Microprocessor Week1: IntroductionMicroprocessor Week1: Introduction
Microprocessor Week1: IntroductionArkhom Jodtang
 
nullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bitsnullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bitsn|u - The Open Security Community
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbgArno Huetter
 
How to reset cisco 2960 to factory default
How to reset cisco 2960 to factory defaultHow to reset cisco 2960 to factory default
How to reset cisco 2960 to factory defaultIT Tech
 
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...Felipe Prado
 

Similar a Machine Problem 1 (20)

embedded C.pptx
embedded C.pptxembedded C.pptx
embedded C.pptx
 
Fundamentals of Physical Memory Analysis
Fundamentals of Physical Memory AnalysisFundamentals of Physical Memory Analysis
Fundamentals of Physical Memory Analysis
 
Fundamentals of Complete Crash and Hang Memory Dump Analysis
Fundamentals of Complete Crash and Hang Memory Dump AnalysisFundamentals of Complete Crash and Hang Memory Dump Analysis
Fundamentals of Complete Crash and Hang Memory Dump Analysis
 
Debugging TV Frame 0x16
Debugging TV Frame 0x16Debugging TV Frame 0x16
Debugging TV Frame 0x16
 
Loaders
LoadersLoaders
Loaders
 
06 - ELF format, knowing your friend
06 - ELF format, knowing your friend06 - ELF format, knowing your friend
06 - ELF format, knowing your friend
 
International Burmese democratic forces and friends of Burma who
International Burmese democratic forces and friends of Burma who International Burmese democratic forces and friends of Burma who
International Burmese democratic forces and friends of Burma who
 
Linux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewLinux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver Overview
 
Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)
Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)
Fundamentals of Complete Crash and Hang Memory Dump Analysis (Revision 2)
 
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with bineeDEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
DEF CON 27 - KYLE GWINNUP - next generation process emulation with binee
 
Process.org
Process.orgProcess.org
Process.org
 
CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy
CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy
CNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphyCNS__M4_MD5 Crypto graphy
 
SANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry AnalysisSANS Forensics 2009 - Memory Forensics and Registry Analysis
SANS Forensics 2009 - Memory Forensics and Registry Analysis
 
Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0Efficient Data Storage for Analytics with Apache Parquet 2.0
Efficient Data Storage for Analytics with Apache Parquet 2.0
 
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
 
Microprocessor Week1: Introduction
Microprocessor Week1: IntroductionMicroprocessor Week1: Introduction
Microprocessor Week1: Introduction
 
nullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bitsnullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bits
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbg
 
How to reset cisco 2960 to factory default
How to reset cisco 2960 to factory defaultHow to reset cisco 2960 to factory default
How to reset cisco 2960 to factory default
 
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
DEF CON 27 - XILING GONG PETER PI - exploiting qualcom wlan and modem over th...
 

Más de ececourse

Machine Problem 2
Machine Problem 2Machine Problem 2
Machine Problem 2ececourse
 
Chapter 2 Hw
Chapter 2 HwChapter 2 Hw
Chapter 2 Hwececourse
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 Cececourse
 
C:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 BC:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 Bececourse
 
Chapter 2 Part2 A
Chapter 2 Part2 AChapter 2 Part2 A
Chapter 2 Part2 Aececourse
 
Chapter 2 Part1
Chapter 2 Part1Chapter 2 Part1
Chapter 2 Part1ececourse
 

Más de 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
 
Mem Tb
Mem TbMem Tb
Mem Tb
 
Machine Problem 2
Machine Problem 2Machine Problem 2
Machine Problem 2
 
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
 

Último

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Machine Problem 1

  • 1. Prof. A.B Department of Electrical and Computer Engineering Spring’10 EECE 321 – Computer Organization Project – Machine Problem 1: Modeling Memory in VHDL [10 points] Throughout this semester, you will be working on your course project in pieces through a set of machine problems which be released on a regular basis. At the end of the semester, you will assemble the blocks you designed in these machine problems to implement a pipelined MIPS processor (more details to follow). So make sure you save your designs and document them in order to use them later. Your final grade on the project will be the sum of the grades you accumulate on the machine problems. All machine problems must be done using Modelsim version 6.5d. Follow the link on other ECE section web site for more information. In the first machine problem (MP1), you will learn how to model memory using VHDL. Please refer to the two VHDL source files auxiliary.vhd and mem_tb.vhd that are provided along with MP1. The file auxiliary.vhd is a VHDL package containing some user-defined constants, data types, functions, and procedures that you frequently need when performing memory operations. You can add your own functions to this package as needed. The file mem_tb.vhd contains a test bench for memory which you can use to experiment with. The following is a description of the contents of these two files. auxiliary.vhd: • MIPS_WORD_SIZE_IN_BYTES is a constant that refers to the number of BYTES within a WORD in MIPS. • MIPS_WORD is a data type that models a 32-bit word in MIPS. It is basically a 32-bit std_logic_vector. To define a variable in VHDL of type MIPS_WORD, use VARIABLE word : MIPS_WORD; The same applies for defining a signal in VHDL. • MEM_ARRAY is a data type which models an array whose elements are MIPS_WORDs. To define a memory that contains 64 words, use VARIABLE mem : MEM_ARRAY(1 to 64); • The procedure init_mem initializes memory from an external input file. The format of the input file is as follows: 00000000 00000010 00000004 00000011 00000008 00000012 0000000c 00000013 … Each line contains two fields separated by a white space. The first field is an address in hex format. The address is composed of 8 hexadecimal digits. The second field contains the data corresponding to that address, again in hexadecimal. init_mem reads this file and initialize memory, writing the data at the corresponding locations, and filling zeros in all other locations that may not be specified in the input file. • The procedure copy_mem_2_file does the opposite of init_mem. It takes a snapshot of memory and writes its contents into an external file, again in the same format defined above. • The function load_word returns the contents of memory at some address in the form of a MIPS_WORD as defined above. • The procedure store_word stores a word into memory at some address. • The procedures read_hex_2_natural and read_hex_2_word are auxiliary functions used in parsing a line from a file and translating it from hexadecimal into a decimal number or a MIPS_WORD.
  • 2. mem_tb.vhd: • The file starts by loading some IEEE packages. • Next, the auxiliary package defined above is loaded. • A dummy entity is defined, followed by an architecture. • The architecture contains one simple process which you can modify to perform various memory operations. • A memory variable mem is defined within this process. The memory contains 64 MIPS words. • Two constants are defined to provide paths to an input file used to initialize memory and output file used to take a snapshot of memory after performing some store operations. • The statement init_mem(in_fname, mem) initializes memory from the input file specified by in_fname. • The following loop loads the contents of memory one at a time and prints the contents to the output console (just for demonstration purposes). • The next three sets of statements before the second loop perform three store operations to memory. Data 0x22 is written to address 0x4, data 0x33 is written to address 0xC, and data 0x44 is written to address 0x14. Note the syntax in VHDL how to specify literals in various bases: o Example:  12343 -- base 10 integer literal  2#10011110# -- base 2 (binary) integer literal  8#720# -- base 8 (octal) integer literal  16#FFFF0ABC# -- base 16 (hex) integer literal • The next for loop simply prints the new contents of memory onto the output console • The statement copy_mem_2_file(out_fname, mem) prints the contents of memory into an external file. Your tasks in this machine problem are: • Understand the various functions and procedures defined in auxiliary.vhd and how they are used in mem_tb.vhd. • Create a directory in your system called mp1. Under mp1, create three subdirectories: mti, src, io. Create a VHDL project called mp1.prj under mp1mti. Then, add all your VHDL source files (i.e., with extensions .vhd) under mp1src. Create a text file called mem_input_file.txt and save the data shown on the next page in this file. Save mem_input_file.txt under mp1io. Make sure you do not have white spaces at the end of the file. • Modify mem_tb.vhd to create a memory that has 32 MIPS words. Initialize this memory from an external file whose format is as described above. Then sort the contents of memory in ascending order. The sorted data must then be written back to memory. The output file as a result of your simulation will automatically be written to mp1iomem_image_file.txt. • Deliverables: The whole VHDL project directory. • mp1 • mti  includes mp1.prj • src  includes all your source files • io  includes all your input and output data files
  • 3. Contents of mem_input_file.txt: 00000000 0000a010 00000004 00009111 00000008 00000f12 0000000c 00010013 00000010 0000bb10 00000014 0000c11c 00000018 00000fee 0000001c 0001fa13 00000020 0000a7a8 00000024 000012b4 00000028 000044d5 0000002c 0000ffcf 00000030 00054a2a 00000034 000431eb 00000038 00032fec 0000003c 000810ed 00000040 0000a039 00000044 000f9138 00000048 00000f37 0000004c 00010036 00000050 0001a035 00000054 00009124 00000058 00010f03 0000005c 00000002 00000060 0001a021 00000064 0001912a 00000068 00010f2b 0000006c 0000002c 00000070 0002a0ed 00000074 000391ee 00000078 00040fef 0000007c 000000e0