Skip to content

Commit 7d360ad

Browse files
committed
Created and compiled using Makefile
1 parent 3f8a1da commit 7d360ad

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CC=gcc
2+
CFLAGS=-I.
3+
DEPS = vmtypes.h
4+
5+
%.o: %.c $(DEPS)
6+
$(CC) -c -o $@ $< $(CFLAGS)
7+
8+
vm_sim: vmtypes.o vm_sim.o
9+
gcc -o vm_sim vm_sim.o vmtypes.o -I.

vm_sim.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
(8) How to use fgets() function: https://stackoverflow.com/a/19609987
4040
4141
COMPILE AND PROGRAM EXECUTION COMMANDS:
42-
(1) Compiled using clang compiler: $ clang -o vm_sim vm_sim.c vmtypes.c
42+
(1) Compiled and tested using clang compiler: $ clang -o vm_sim vm_sim.c vmtypes.c
4343
(2) Executed program with command: $ ./vm_sim InputFile.txt
44+
(3) Compiled and tested using gcc: $ gcc -o vm_sim vm_sim.c vmtypes.c
45+
(4) Created Makefile with gcc as Constant
4446
4547
*/
4648

@@ -164,7 +166,7 @@ int main(int argc, char *argv[])
164166
translationCount++; // increment the number of translated addresses
165167
}
166168

167-
printf("\n-------------------------------------------------------------------\n");
169+
printf("\n---------------------------------------------------------------------------\n");
168170
// calculate and print out the stats
169171
printf("\nNumber of translated addresses = %d\n", translationCount);
170172
double pfRate = (double)pageTable->pageFaultCount / (double)translationCount;
@@ -174,7 +176,7 @@ int main(int argc, char *argv[])
174176
printf("Page Fault Rate = %.3f %%\n",pfRate * 100);
175177
printf("TLB Hits = %d\n", tlbTable->tlbHitCount);
176178
printf("TLB Hit Rate = %.3f %%\n", TLBRate * 100);
177-
printf("\n-------------------------------------------------------------------\n");
179+
printf("\n---------------------------------------------------------------------------\n");
178180

179181
// close the input file and backing store
180182
fclose(address_file);

vm_sim.o

7.31 KB
Binary file not shown.

vmtypes.o

2.86 KB
Binary file not shown.

0 commit comments

Comments
 (0)