Newer
Older
DE2_115_PROG / software / qsys_tutorial_lcd4 / sys_prog.c
@takayun takayun on 16 Dec 2016 556 bytes initial commit
/*
 * sys_prog.c
 *
 *  Created on: 2016/12/15
 *      Author: takayun
 */

#include "sys_register.h"
#include "sys_memory.h"

unsigned int inc_pc() {
	if ((unsigned char)global_registers[Spc]+1 < MEM_SIZE*MEMS_COUNT - global_current_memory*MEM_SIZE ) {
		global_registers[Spc] = (unsigned char)global_registers[Spc] + 1;
	} else {
		global_registers[Spc] = 0;
	}
	return 0;
}
unsigned int add_pc(unsigned int cnt) {
	int i;
	for (i = 0; i < cnt; i++) inc_pc();
	return 0;
}
unsigned int set_pc(unsigned int cnt) {
	global_registers[Spc]=cnt;
	return 0;
}