Skip to content
Snippets Groups Projects
Commit e67818ae authored by Brandon Rodriguez's avatar Brandon Rodriguez
Browse files

Realize that Python is allowed for this project. Update files accordingly

parent 240226a7
Branches
No related merge requests found
# Do not track local environment settings/solution. # Do not track local environment settings.
.vscode/ .env/
.venv/
.idea/ .idea/
.vs/ .vs/
.vscode/
env/
venv/
# Ignore compiled files. # Ignore compiled files.
*.out *.out
.csim_results .csim_results
# Do not track python cache files.
*.pyc
# Do not track local environment logs.
*.log
*.log.*
/**
* Date: 02-28-20
* Class: CS 5541
* Assignment: Cache Simulator
* Author: Brandon Rodriguez
* Email: bfp5870@wmich.edu
*
*
* Simulates system use of a cache for data storage.
*/
// Import headers.
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Constant Defines.
// Variable Declaration.
// Method Declaration.
/**
* Program's main.
* Initializes and runs program.
*/
int main(int argc, char* argv[]) {
printf("Starting program.\n");
printf("\n\nTerminating program.\n");
}
main.py 0 → 100644
"""
Date: 02-28-20
Class: CS 5541
Assignment: Cache Simulator
Author: Brandon Rodriguez
Email: bfp5870@wmich.edu
Simulates system use of a cache for data storage.
Cache Settings Arguments:
* S: Number of sets in cache.
* E: Lines per set.
* B: Block size (number of bits per block).
"""
# System Imports.
# User Imports.
def main():
"""
Program main.
"""
pass
if __name__ == '__main__':
print('Starting program.')
main()
print('Terminating program.')
# Tell makefile to use commands defined here, if file with same name exists.
.PHONY: all compile run valgrind clean
# Set default if none is specified.
default: valgrind clean
# Fully build and execute project.
all: compile run clean
# Compile program.
compile:
gcc -Wall -Wpedantic -std=c99 *.c
# Compile and run program.
run: compile
./a.out
# Compile program and run with valgrind (memory checking).
valgrind: compile
valgrind --leak-check=full ./a.out
# Clean up directory.
clean:
@rm -f *.o
@rm -f a.out
# Display help output.
help:
@echo "Default: Executes \"valgrind\", then \"clean\"."
@echo ""
@echo "Available Commands:"
@echo " all - Executes \"run\", then \"clean\"."
@echo " compile - Compiles program to \"a.out\"."
@echo " run - Compiles program to \"a.out\". Then run."
@echo " valgrind - Compiles program to \"a.out\". Then run with memory error checking."
@echo " clean - Remove temporary/compiled files from directory."
...@@ -59,9 +59,6 @@ function execute_single_file () { ...@@ -59,9 +59,6 @@ function execute_single_file () {
echo -e "${color_blue}Found input file \"$file\". Attempting to compile C code.${color_reset}" echo -e "${color_blue}Found input file \"$file\". Attempting to compile C code.${color_reset}"
# Attempt to compile C code.
make compile
# Run input file on example cache simulator file. # Run input file on example cache simulator file.
echo "" echo ""
echo -e "${color_blue}Running input file on \"wmucachelab/csim-ref\". Runtime args:${color_reset}" echo -e "${color_blue}Running input file on \"wmucachelab/csim-ref\". Runtime args:${color_reset}"
...@@ -72,10 +69,7 @@ function execute_single_file () { ...@@ -72,10 +69,7 @@ function execute_single_file () {
echo "" echo ""
echo -e "${color_blue}Running input file on compiled C code. Runtime args:${color_reset}" echo -e "${color_blue}Running input file on compiled C code. Runtime args:${color_reset}"
echo -e "${color_blue} -v -s 4 -E 1 -b 4 -t $file${color_reset}" echo -e "${color_blue} -v -s 4 -E 1 -b 4 -t $file${color_reset}"
./a.out -v -s 4 -E 1 -b 4 -t $file python3 main.py -v -s 4 -E 1 -b 4 -t $file
# Clean up directory.
make clean
else else
echo -e "${color_red}Failed to determine absolute path for input file.${color_reset}" echo -e "${color_red}Failed to determine absolute path for input file.${color_reset}"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment