CPU
cpu.cpp File Reference
#include "cpu.h"
Include dependency graph for cpu.cpp:

Functions

void cpucode_file_input (CpuCode *some_cpucode, const char *filename)
 Reads machine code from file given and checks its version compatibility. More...
 
void execute_cpucode (CPU *some_cpu, CpuCode *some_cpucode)
 Executes machine code sequence on the CPU. More...
 
void free_cpucode (CpuCode *some_cpucode)
 Frees memory allocated by the cpucode array. More...
 
void execute_cpu (CPU *some_cpu, instruction_type instruction, descriptional_argument descr_arg, cpu_operand_t operand)
 Executes instruction with arguments and operands given on the CPU. More...
 
void start_cpu (CPU *some_cpu)
 Executes STRT instruction on the CPU. More...
 
void push_cpu (CPU *some_cpu, descriptional_argument descr_arg, cpu_operand_t value)
 Executes PUSH instruction with the arguments and operands given on the CPU. More...
 
void pop_cpu (CPU *some_cpu, descriptional_argument descr_arg)
 Executes POP instruction with the arguments given on the CPU. More...
 
void add_cpu (CPU *some_cpu)
 Executes ADD instruction on the CPU. More...
 
void sub_cpu (CPU *some_cpu)
 Executes SUB instruction on the CPU. More...
 
void mul_cpu (CPU *some_cpu)
 Executes MUL instruction on the CPU. More...
 
void div_cpu (CPU *some_cpu)
 Executes DIV instruction on the CPU. More...
 
void out_cpu (CPU *some_cpu)
 Executes OUT instruction on the CPU. More...
 
void hlt_cpu (CPU *some_cpu)
 Executes HLT instruction on the CPU. More...
 

Function Documentation

◆ add_cpu()

void add_cpu ( CPU some_cpu)

Executes ADD instruction on the CPU.

Here is the caller graph for this function:

◆ cpucode_file_input()

void cpucode_file_input ( CpuCode some_cpucode,
const char *  filename 
)

Reads machine code from file given and checks its version compatibility.

Here is the caller graph for this function:

◆ div_cpu()

void div_cpu ( CPU some_cpu)

Executes DIV instruction on the CPU.

Here is the caller graph for this function:

◆ execute_cpu()

void execute_cpu ( CPU some_cpu,
instruction_type  instruction,
descriptional_argument  descr_arg,
cpu_operand_t  operand 
)

Executes instruction with arguments and operands given on the CPU.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute_cpucode()

void execute_cpucode ( CPU some_cpu,
CpuCode some_cpucode 
)

Executes machine code sequence on the CPU.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_cpucode()

void free_cpucode ( CpuCode some_cpucode)

Frees memory allocated by the cpucode array.

Here is the caller graph for this function:

◆ hlt_cpu()

void hlt_cpu ( CPU some_cpu)

Executes HLT instruction on the CPU.

Here is the caller graph for this function:

◆ mul_cpu()

void mul_cpu ( CPU some_cpu)

Executes MUL instruction on the CPU.

Here is the caller graph for this function:

◆ out_cpu()

void out_cpu ( CPU some_cpu)

Executes OUT instruction on the CPU.

Here is the caller graph for this function:

◆ pop_cpu()

void pop_cpu ( CPU some_cpu,
descriptional_argument  descr_arg 
)

Executes POP instruction with the arguments given on the CPU.

Here is the caller graph for this function:

◆ push_cpu()

void push_cpu ( CPU some_cpu,
descriptional_argument  descr_arg,
cpu_operand_t  value 
)

Executes PUSH instruction with the arguments and operands given on the CPU.

TODO добавить полноценную поддержку

Here is the caller graph for this function:

◆ start_cpu()

void start_cpu ( CPU some_cpu)

Executes STRT instruction on the CPU.

Here is the caller graph for this function:

◆ sub_cpu()

void sub_cpu ( CPU some_cpu)

Executes SUB instruction on the CPU.

Here is the caller graph for this function:
cpucode_file_input
void cpucode_file_input(CpuCode *some_cpucode, const char *filename)
Reads machine code from file given and checks its version compatibility.
Definition: cpu.cpp:5
cpu_operand_t
int cpu_operand_t
Definition: cpu.h:9
CpuCode
< Describes machine code that can be loaded from file and executed
Definition: cpu.h:70
free_cpucode
void free_cpucode(CpuCode *some_cpucode)
Frees memory allocated by the cpucode array.
Definition: cpu.cpp:76
main
int main()
Definition: main.cpp:18
instruction_type
instruction_type
TODO включить общим файлом или сделать что-то подобное
Definition: cpu.h:34
execute_cpucode
void execute_cpucode(CPU *some_cpu, CpuCode *some_cpucode)
Executes machine code sequence on the CPU.
Definition: cpu.cpp:39
cpu.h
CPU
< Describes CPU with its stack, registers and RAM
Definition: cpu.h:77