狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线

代寫CSCI 2122、C++編程設(shè)計(jì)代做

時(shí)間:2024-04-08  來(lái)源:  作者: 我要糾錯(cuò)



CSCI 2122 Assignment 5
Due date: 11:59pm, Tuesday, April 9, 2024, submitted via git
Objectives
The purpose of this assignment is to practice your coding in C, and to reinforce the concepts discussed in
class on pointers, caching, and the memory hierarchy.
In this assignment you will implement a cache simulator that uses a limited amount of memory.
Preparation:
1. Complete Assignment 0 or ensure that the tools you would need to complete it are installed.
2. Clone your assignment repository:
where is your CSID. Please see instructions in Assignment 0 and the tutorials on Brightspace if
you are not sure how.
Inside the repository there is one directory: cachex, where code is to be written. You should set up a
CLion project for this directory. Inside the directory is a tests directory that contains tests that will be
executed each time you submit your code. Please do not modify the tests directory or the .gitlabci.yml file that is found in the root directory. Modifying these files may break the tests. These files will
be replaced with originals when the assignments are graded. You are provided with a sample Makefile
file that can be used to build your program. If you are using CLion, a Makefile will be generated from
the CMakeLists.txt file generated by CLion.
Background:
Fast memory is expensive. Cache designers are limited by the amount of fast memory that they can use.
Furthermore, the fast memory must store not only the data being cached but all the metadata as well,
such as tags, the valid bit, and the timestamp. Naturally, cache designers simulate their designs in software before implementing in hardware. In this assignment, you will do the same.
Your task is to implement a cache module that simulates a cache. The choice of the type of cache is up to
you. Your cache module will be provided with two parameters: F, the amount of “fast” memory that your
cache may use and M, the amount of memory in the simulated system, from which data will be cached.
As well, your module will be provided a pointer to the “fast” memory of size F. Your cache module may
ONLY use this “fast” memory (apart from local variables) to implement the cache. In short, any data that
is needed to manage the cache, as well as the data being cached, must be stored in the “fast” memory.
Caches
Recall that a cache is defined by several parameters:
S: the number of sets
E: the number of lines per set
B: the number of bytes each line caches
The size of the cache is C = S x E x B. The type of cache depends on these parameters:
• In direct mapped caches, E = 1, i.e., there is one (1) line per set,
• In fully associative caches, S = 1, i.e., all lines are in a single set, and
• In set associative caches, S > 1 and E > 1, i.e., there are multiple sets, each with multiple lines.
When a cache receives a memory reference, it
1. Breaks up the address into a tag, a set index, and an offset.
2. Uses the index to identify the set where the referenced memory may be cached
3. Uses the tag to determine if a line in the set is caching the referenced memory
4. If the referenced memory is not being cached,
a. The cache determines if the set contains an unused line
b. If no lines are unused, the cache will evict a used line.
c. The line is then loaded with the block of memory containing the reference.
5. At this point, a line in the selected set is caching the memory being referenced. The cache returns
the data being referenced.
The choice of what type of cache to use, is completely up to you. The only restriction is that all parts of
the cache must fit into F bytes of the “fast” memory and that the line size B ≥ 32 bytes.
Reference Streams
A reference stream is simply a sequence of memory references (addresses), representing a program running and accessing memory as it runs. The first integer, R, denotes
the number of memory references that follow. The next R integers are the memory
addresses.
The Cache Simulator
Your cache simulator takes as input (i) a system configuration that includes:
• F_size: Size of the “fast” memory where F_size ≥ 256
• F_memory: A pointer to the “fast” memory
• M_size: Size of main memory
(ii) a reference stream, and (iii) an optional “stats” command that causes the simulator to print out the
cache hit/miss count and hit-rate. The simulator instantiates the system being simulated and then processes the reference stream, by sending each reference to the cache. The cache will forward the request
to the main memory, if the request causes a miss, loading a line from the memory. Once the requested
data is in the cache, the cache returns the requested data. The simulator counts the hits and misses that
occur, and can output the hit-rate after the reference stream completes.
Your task will be to implement the cache module in the Cache Simulator.
Task: Implement the cache.c for the Simulator
Your task is to implement the cache.c module by implementing one function. The function is declared
in cache.h and is called from main.c. The function is:
int cache_get(unsigned long address, unsigned long *value)
This function takes a memory address and a pointer to a value and loads a word (a long) located
at memory address and copies it into the location pointed to by value. I.e., this is what the CPU
does when it needs to load a word from memory, it requests it from the cache. The function takes
two (2) parameters:
• address : the location of the value to be loaded. Addresses are the memory references
from the reference stream.
• value : a pointer to a buffer of where the word is to be copied into.
The function returns a 1 on success and a 0 on failure. The function performs two steps:
1. Check if the cache system has been initialized. If not, the initialize the cache.
2. Process the request, by returning the value at the specified memory address.
9
22
48
70
4118
22
4118
2070
4118
22
Step 1: Checking and Initializing the Cache
The function has access to a global struct called c_info, which is defined in cache.h. The struct is
struct cache_info {
 void *F_memory; /* pointer to "fast" memory */
 unsigned int F_size; /* size of "fast" memory (in bytes) */
 unsigned int M_size; /* size of main memory (in bytes) */
};
The pointer c_info.F_memory points to a memory chunk of size c_info.F_size. The memory is
initialized to all 0s. This is the only memory, except for local variables that you may use in implementing
the cache. You may not use calloc() or malloc(), or create any additional static or global variables.
The recommended approach is to define a struct and place it at the start of the “fast” memory pointed
to by F_memory. The struct can point to an array of structs representing sets or lines also located in the
“fast” memory. These structs can contain pointers, pointing to lines (that store data), and which are also
kept in the “fast” memory.
Have an “initialized” flag in the struct at the start of the “fast” memory that is set to 1 if the cache is
initialized and 0 otherwise. Hint: create a static init() function in cache.c that is called from
cache_get() if the “initialized” flag is 0. The init() function can then set up all the pointers and
structures. Note: It is up to you to decide on how many sets and lines the cache will have. The only
restrictions are (1) The minimum size of a line (B) must be 32 bytes. And (ii) everything must fit into
F_size bytes of memory. F_size will be greater or equal to 256. Reminder: one of the things that
init()should do is set the initialized flag to 1.
Step 2: Processing a Request
To process a request, the cache_get() function should:
1. Break up the address into a tag, index, and offset.
2. Use the index to locate the correct set.
3. Use the tag to determine if block of memory that includes the address is in one of the lines in
the set.
4. If it is (a cache hit), the offset is used to locate the word in that line, the word should be copied
into the buffer pointed to by value, and then the function returns.
5. Otherwise, it is a cache miss. In this case, a victim line is selected, initialized with the tag of
the needed memory block, and loaded by calling the function
int memget(unsigned int address, void *buffer, unsigned int size)
which is declared in cache.h and defined in main.c. This function takes the address as
the first parameter, a pointer to a buffer where the block should be loaded, and the size of
the block to get. Hint, the buffer should point to the part of the line storing the block. The
function returns 1 on success and 0 on failure. Each call to memget() counts as a miss.
The rest of the cache simulator is already implemented for you! J
The cachex Mainline
The main.c of cachex is already implemented for you. Below is a brief description of what it does.
Input
The cachex reads input from stdin. The input consists of three parts: (i) a system configuration; (ii) a
reference stream; and (iii) an optional “stats” command.
The system configuration consists of two integers:
• F : the “fast” memory size
• M : the memory size
The reference stream consists of an integer N denoting the number of references, followed by N references. Each reference is an integer between 0 and M – 8, denoting the address in memory being referenced.
After the N memory references, and optional “stats” command may be present. This command consists
of a single word “stats” and causes the simulator to print out the hits, misses, and hit-rate.
Processing
When cachex starts running, it reads in the system configuration, allocates the memory in the system
being simulated, and initializes the c_info struct. The main memory is initialized to a sequence of pseudorandom numbers (the numbers look random, but they are not).
It then enters the main loop and processes the reference stream:
• For each reference, cache_get() is called.
• The loaded value is compared to the expected value and any errors are noted.
During the processing, all cache hits and misses are recorded.
If the “stats” command is present after the memory references, the number of hits and misses is displayed.
Output
The cachex outputs to stdout in two parts: (i) the result of each memory reference as it is being processed; (iii) the aggregates of hits and misses, if the stats command was used.
Example
Input Output
1024 65536
9
22
48
70
4118
22
4118
2070
4118
22
stats
Loaded value [0xb9cb17b29e5109d2] @ address 0x00000016
Loaded value [0x0394fee63984c8dc] @ address 0x00000030
Loaded value [0x8eba29a6bb1465ff] @ address 0x00000046
Loaded value [0x3ce65cc676176add] @ address 0x00001016
Loaded value [0xb9cb17b29e5109d2] @ address 0x00000016
Loaded value [0x3ce65cc676176add] @ address 0x00001016
Loaded value [0x425a273223d06058] @ address 0x00000816
Loaded value [0x3ce65cc676176add] @ address 0x00001016
Loaded value [0xb9cb17b29e5109d2] @ address 0x00000016
Cache hits: 4, misses: 5
Hints and Suggestions
• You will need a couple structs, one for cache and one for line. You may also want one for set.
• Fundamentally, a cache is an array of sets, and a set is an array of lines.
• You should only need to modify one file: cache.c.
• There is not a lot of code to write (my solution under 100 lines).
Grading
If your program does not compile, it is considered non-functional and of extremely poor quality, meaning you will receive 0 for the solution.
The assignment will be graded based on three criteria:
Functionality: “Does it work according to specifications?”. This is determined in an automated fashion by
running your program on several inputs and ensuring that the outputs match the expected outputs. The
score is determined based on the number of tests that your program passes. So, if your program passes
t/T tests, you will receive that proportion of the marks.
Performance: “Does it perform well?”. This is determined in an semi-automated fashion by running your
program on several inputs and the comparing benchmarks of your cache to that of the solution.
Quality of Solution: “Is it a good solution?” This considers whether the approach and algorithm in your
solution is correct. This is determined by visual inspection of the code. It is possible to get a good grade
on this part even if you have bugs that cause your code to fail some of the tests.
Code Clarity: “Is it well written?” This considers whether the solution is properly formatted, well documented, and follows coding style guidelines. A single overall mark will be assigned for clarity. Please see
the Style Guide in the Assignment section of the course in Brightspace.
The following grading scheme will be used:
Task 100% 80% 60% 40% 20% 0%
Functionality
(20 marks) Equal to the number of tests passed.
Performance
(10 marks)
Hit rate of cache
meets or exceeds hit rate of
the solution
Hit rate of cache
is ≥80% of the solution
Hit rate of cache
is ≥60% of the solution
Hit rate of cache
is ≥40% of the
solution
Hit rate of
cache is ≥20%
of the solution
code does not compile
No code submitted or
Solution Quality
(10 marks)
Implemented efficiently and correctly.
Implementation is
correct. All three
types of caches
are functional.
Minor flaws with
implementation,
two of three
types of caches
are functional.
Major flaws in
implementation. One of
three types of
caches work.
An attempt
has been
made.
Code Clarity
(10 marks)
Indentation, formatting, naming,
comments
Code looks professional and follows all style
guidelines
Code looks good
and mostly follows style guidelines.
Code is mostly
readable and
mostly follows
some of the style
guidelines
Code is hard to
read and follows few of the
style guidelines
Code is not
legible
Assignment Submission
Submission and testing are done using Git, Gitlab, and Gitlab CI/CD. You can submit as many times as you
wish, up to the deadline. Every time a submission occurs, functional tests are executed, and you can view
the results of the tests. To submit use the same procedure as Assignment 0.
Assignment Testing without Submission
Testing via submission can take some time, especially if the server is loaded. You can run the tests without
submitting your code by using the provided runtests.sh script. Running the script with no arguments
will run all the tests. Running the script with the test number, i.e., 00, 01, 02, 03, … 09, will run that specific
test. Please see below for how run the script.
Get your program ready to run
If you are developing directly on the unix server,
1. SSH into the remote server and be sure you are in the cachex directory.
2. Be sure the program is compiled by running make.
If you are using CLion
1. Run your program on the remote server as described in the CLion tutorials.
2. Open a remote host terminal via Tools → Open Remote Host Terminal
If you are using VSCode
1. Run your program on the remote server as described in VSCode tutorials.
2. Click on the Terminal pane in the bottom half of the window or via Terminal → New Terminal
Run the test script
3. Run the script in the terminal by using the command:
./runtest.sh
to run all the tests, or specify the test number to run a specific test, e.g. :
./runtest.sh 07
Run the benchmark script
3. Run the script in the terminal by using the command:
./runbench.sh
to run all the tests, or specify the test number to run a specific test, e.g. :
./runbench.sh 03
You will see the bench run in the terminal window.

請(qǐng)加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp


















 

標(biāo)簽:

掃一掃在手機(jī)打開(kāi)當(dāng)前頁(yè)
  • 上一篇:代做DS2500、代寫Python設(shè)計(jì)程序
  • 下一篇:CS 1501代做、代寫Python/Java程序設(shè)計(jì)
  • 無(wú)相關(guān)信息
    昆明生活資訊

    昆明圖文信息
    蝴蝶泉(4A)-大理旅游
    蝴蝶泉(4A)-大理旅游
    油炸竹蟲(chóng)
    油炸竹蟲(chóng)
    酸筍煮魚(yú)(雞)
    酸筍煮魚(yú)(雞)
    竹筒飯
    竹筒飯
    香茅草烤魚(yú)
    香茅草烤魚(yú)
    檸檬烤魚(yú)
    檸檬烤魚(yú)
    昆明西山國(guó)家級(jí)風(fēng)景名勝區(qū)
    昆明西山國(guó)家級(jí)風(fēng)景名勝區(qū)
    昆明旅游索道攻略
    昆明旅游索道攻略
  • NBA直播 短信驗(yàn)證碼平臺(tái) 幣安官網(wǎng)下載 歐冠直播 WPS下載

    關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 kmw.cc Inc. All Rights Reserved. 昆明網(wǎng) 版權(quán)所有
    ICP備06013414號(hào)-3 公安備 42010502001045

    狠狠综合久久久久综合网址-a毛片网站-欧美啊v在线观看-中文字幕久久熟女人妻av免费-无码av一区二区三区不卡-亚洲综合av色婷婷五月蜜臀-夜夜操天天摸-a级在线免费观看-三上悠亚91-国产丰满乱子伦无码专区-视频一区中文字幕-黑人大战欲求不满人妻-精品亚洲国产成人蜜臀av-男人你懂得-97超碰人人爽-五月丁香六月综合缴情在线
  • <dl id="akume"></dl>
  • <noscript id="akume"><object id="akume"></object></noscript>
  • <nav id="akume"><dl id="akume"></dl></nav>
  • <rt id="akume"></rt>
    <dl id="akume"><acronym id="akume"></acronym></dl><dl id="akume"><xmp id="akume"></xmp></dl>
    国产日韩成人内射视频| 日韩中文字幕二区| 色免费在线视频| 久久婷婷五月综合色国产香蕉| 777久久精品一区二区三区无码| 色婷婷一区二区三区av免费看| heyzo国产| 国产在线青青草| 成人一区二区三| 91视频免费版污| 国产视频1区2区3区| 欧美日韩亚洲自拍| 激情久久综合网| 精品日韩在线播放| 欧美亚洲黄色片| 亚洲欧洲日产国码无码久久99 | 91精品一区二区三区四区| 亚洲高清av一区二区三区| 少妇高潮流白浆| 久久久久99精品成人片| 欧美日韩激情视频在线观看| 日韩精品视频久久| 91福利免费观看| 国产成人艳妇aa视频在线| 亚洲 自拍 另类小说综合图区| 哪个网站能看毛片| 男人的天堂最新网址| 在线观看污视频| 成年人视频在线免费| 黄色a级三级三级三级| 国产精品久久久久久久久电影网| 国产一区二区视频播放| 91视频这里只有精品| 亚洲乱码日产精品bd在线观看| 亚洲熟妇国产熟妇肥婆| 三区视频在线观看| 精品久久久久久久久久中文字幕| 麻豆一区二区三区视频| 成人免费视频91| 亚洲一区二区三区观看| youjizz.com在线观看| 少妇一级淫免费放| a在线视频观看| 欧美美女黄色网| 性生生活大片免费看视频| 一本久道高清无码视频| 亚洲女人在线观看| 国产精品无码av无码| 久久久性生活视频| www.亚洲自拍| 一道本在线免费视频| 女性隐私黄www网站视频| 黄色一级大片免费| 超碰在线资源站| 黄色永久免费网站| 国产熟女高潮视频| av黄色在线网站| 人体内射精一区二区三区| 妞干网这里只有精品| 色呦色呦色精品| 亚洲精品午夜在线观看| 国产日韩成人内射视频 | 免费在线观看的av网站| 国产www免费| 国产成人永久免费视频| 四虎4hu永久免费入口| 熟女熟妇伦久久影院毛片一区二区| 午夜免费一区二区| 手机视频在线观看| 15—17女人毛片| 亚洲一级免费在线观看| 岛国av免费在线| 久久久精品视频国产| 黄色a级在线观看| 六月婷婷激情网| 一级特黄妇女高潮| 日韩精品免费一区| 免费av手机在线观看| 黄色国产精品视频| 久久久久久久久久一区| 激情久久综合网| 日本a视频在线观看| 久久久久免费精品| 青青草久久伊人| 国产精品久久久久久久久电影网| 国产av麻豆mag剧集| av免费中文字幕| 成人免费黄色av| 国产午夜大地久久| 中文字幕在线综合| www.好吊操| 另类小说第一页| 久久天天东北熟女毛茸茸| 青青青青草视频| 天堂av在线8| 国产一区二区在线视频播放| 韩日视频在线观看| 久久九九国产视频| 久久久久久三级| 少妇一级淫免费放| 看一级黄色录像| 免费国产黄色网址| 亚洲欧美久久久久| 免费特级黄色片| 午夜免费福利网站| 成人在线观看黄| 白白操在线视频| 色免费在线视频| 国产美女三级视频| 精品少妇人欧美激情在线观看| 天天色综合社区| 美女av免费在线观看| 无码毛片aaa在线| 亚洲a级黄色片| 国产精品无码一本二本三本色| 男人的天堂avav| 国产日韩视频在线播放| 男人女人黄一级| 精品这里只有精品| 国产精品国产三级国产专区51| 最新免费av网址| xxx国产在线观看| 性欧美极品xxxx欧美一区二区| 妺妺窝人体色777777| 青青草免费在线视频观看| xxxx在线免费观看| www.com污| 亚洲黄色av片| 亚洲免费黄色录像| 亚洲精品视频三区| 亚洲欧美久久久久| 少妇一级淫免费播放| 无码人妻精品一区二区三区66| 可以看毛片的网址| 亚洲人成无码网站久久99热国产| 成人小视频在线观看免费| 久久久国产精华液999999| 五月婷婷狠狠操| 久久久久国产一区| 日本高清久久久| 国产资源中文字幕| 17c丨国产丨精品视频| 青青青在线视频播放| 国产91对白刺激露脸在线观看| 欧美日韩国产精品激情在线播放| 免费黄色日本网站| 中文av一区二区三区| 一级片免费在线观看视频| 五月天在线免费视频| www.好吊操| 国产l精品国产亚洲区久久| 国产九九在线视频| 日日夜夜精品视频免费观看| 黄色录像特级片| 国产真实乱子伦| 亚洲视频第二页| 天天做天天躁天天躁| 能在线观看的av| 亚欧精品在线视频| 日韩欧美视频网站| 一区二区三区 欧美| 女人被男人躁得好爽免费视频| 欧美视频在线观看视频| 日本a级片免费观看| 亚洲欧美日韩三级| 少妇无码av无码专区在线观看| 九九热99视频| 日韩av一二三四区| 国产三级精品三级在线| 秋霞无码一区二区| 91社在线播放| 波多野结衣天堂| 国产原创popny丨九色| 亚洲高清视频免费| 久久久久久久久久久久久久国产| 99九九精品视频| av污在线观看| av动漫在线看| 粉嫩av一区二区三区天美传媒 | 肉大捧一出免费观看网站在线播放| 国产乱子夫妻xx黑人xyx真爽| 天堂av免费看| 亚洲天堂2018av| 欧美黄色一级片视频| 精品国产一区三区| www国产无套内射com| 日本高清免费观看| 国产九九在线观看| 亚洲老女人av| 爆乳熟妇一区二区三区霸乳| 人妻无码久久一区二区三区免费| 18视频在线观看娇喘| 三区视频在线观看| 日韩a一级欧美一级| 波多结衣在线观看| www.亚洲高清| 在线观看中文av| 欧美h视频在线观看| av磁力番号网| 日韩精品手机在线观看|