data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v
1: b"%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:142: Cannot find file containing module: 'memory_protection_unit'\n memory_protection_unit mpu(\n ^~~~~~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1,data/full_repos/permissive/172396252/memory_protection_unit\n             data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1,data/full_repos/permissive/172396252/memory_protection_unit.v\n             data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1,data/full_repos/permissive/172396252/memory_protection_unit.sv\n             memory_protection_unit\n             memory_protection_unit.v\n             memory_protection_unit.sv\n             obj_dir/memory_protection_unit\n             obj_dir/memory_protection_unit.v\n             obj_dir/memory_protection_unit.sv\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:153: Cannot find file containing module: 'memory_interface'\n memory_interface mem_interface(\n ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:175: Cannot find file containing module: 'register'\n register temp_reg(\n ^~~~~~~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:184: Cannot find file containing module: 'alu'\n alu alu(\n ^~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:199: Cannot find file containing module: 'register_file'\n register_file reg_file(\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:213: Cannot find file containing module: 'instruction_register'\n instruction_register ir(\n ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:225: Cannot find file containing module: 'program_counter'\n program_counter pc(\n ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:235: Cannot find file containing module: 'special_register_file'\n special_register_file special_regs(\n ^~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/172396252/WRAMPsys.srcs/sources_1/cpu.v:255: Cannot find file containing module: 'control_unit'\n control_unit cu(\n ^~~~~~~~~~~~\n%Error: Exiting due to 9 error(s)\n"
module CPU(

	input rst_n,
	input clk,


	output write_enable_n,
	output read_enable_n,


	inout [31:0] data_bus,


	output [23:0] address_bus,


	output rom_cs_n,
	output ram_cs_n,
	output timer_cs_n,
	output parallel_cs_n,
	output serial1_cs_n,
	output serial2_cs_n,
	output aux1_cs_n,
	output aux2_cs_n,
	output sys_cs_n,


	input break_irq_n,
	input user_irq_n,
	input timer_irq_n,
	input parallel_irq_n,
	input serial1_irq_n,
	input serial2_irq_n,
	input aux1_irq_n,
	input aux2_irq_n,

	input rom_lock
 	);
 
 
 

	wire [31:0] A_bus;
	wire [31:0] B_bus;
	wire [31:0] C_bus;


	wire check_mem;
	wire kernel_mode;
	wire [19:0] mpu_address_out;
	wire [19:0] user_base;
	wire [19:0] protection_table;
	wire memory_violation;


	wire mem_read_en;
	wire mem_write_en;


	wire temp_read_en;
	wire temp_write_en;


	wire [4:0] alu_func;
	wire alu_start;
	wire alu_finished;
	wire alu_out_en;
	wire zero;
	wire overflow;
	wire div_zero;


	wire       reg_a_read_en;
	wire [3:0] reg_a_sel;
	wire       reg_b_read_en;
	wire [3:0] reg_b_sel;
	wire       reg_write_en;
	wire [3:0] reg_write_sel;


	wire ir_write_en;
	wire imm_16_out;
	wire imm_20_out;
	wire sign_extend_imm;
	wire [31:0] current_instruction;


	wire pc_inc;
	wire pc_write_en;
	wire pc_read_en;



	wire [3:0] special_reg_sel;
	wire       special_reg_read_en;
	wire       special_reg_write_en;
	wire       inc_icount;
	wire       save_state;
	wire       restore_state;
	wire [7:0] interrupt_mask;
	wire [3:0] exception_status;
	wire [7:0] interrupts;
	wire       interrupts_enabled;


	assign address_bus[23:20] = 4'h0;


	assign interrupts[0] = 0;
	assign interrupts[1] = ~user_irq_n;
	assign interrupts[2] = ~timer_irq_n;
	assign interrupts[3] = ~parallel_irq_n;
	assign interrupts[4] = ~serial1_irq_n;
	assign interrupts[5] = ~serial2_irq_n;
	assign interrupts[6] = ~aux1_irq_n;
	assign interrupts[7] = ~aux2_irq_n;
	

	memory_protection_unit mpu(
		.check_mem(check_mem),
		.user_mode(~kernel_mode),
		.address_in(B_bus[19:0]),
		.address_out(mpu_address_out),
		.user_base(user_base),
		.protection_table(protection_table),
		.load_data(C_bus),
		.memory_violation(memory_violation)
	);

	memory_interface mem_interface(
		.data_in(A_bus),
		.data_out(C_bus),
		.cpu_address(mpu_address_out),
		.mem_read(mem_read_en),
		.mem_write(mem_write_en),
		.rom_lock(rom_lock),
		.data_bus(data_bus),
		.address_bus(address_bus[19:0]),
		.serial1_cs_n(serial1_cs_n),
		.serial2_cs_n(serial2_cs_n),
		.parallel_cs_n(parallel_cs_n),
		.timer_cs_n(timer_cs_n),
		.ram_cs_n(ram_cs_n),
		.rom_cs_n(rom_cs_n),
		.aux1_cs_n(aux1_cs_n),
		.aux2_cs_n(aux2_cs_n),
		.sys_cs_n(sys_cs_n),
		.write_enable_n(write_enable_n),
		.read_enable_n(read_enable_n)
	);

	register temp_reg(
		.rst_n(rst_n),
		.clk(clk),
		.write_enable(temp_write_en),
		.write_value(C_bus),
		.read_enable(temp_read_en),
		.read_value(B_bus)
	);

	alu alu(
		.rst_n(rst_n),
		.clk(clk),
		.func(alu_func),
		.operand_a(A_bus),
		.operand_b(B_bus),
		.start(alu_start),
		.finished(alu_finished),
		.out_enable(alu_out_en),
		.out_bus(C_bus),
		.zero(zero),
		.overflow_out(overflow),
		.div_zero_out(div_zero)
	);

	register_file reg_file(
		.rst_n(rst_n),
		.clk(clk),
		.read_a_enable(reg_a_read_en),
		.read_a_select(reg_a_sel),
		.read_a_value(A_bus),
		.read_b_enable(reg_b_read_en),
		.read_b_select(reg_b_sel),
		.read_b_value(B_bus),
		.write_enable(reg_write_en),
		.write_select(reg_write_sel),
		.write_value(C_bus)
	);

	instruction_register ir(
		.rst_n(rst_n),
		.clk(clk),
		.write_enable(ir_write_en),
		.write_data(C_bus),
		.imm_16_out(imm_16_out),
		.imm_20_out(imm_20_out),
		.sign_extend(sign_extend_imm),
		.a_out(A_bus),
		.current_instruction(current_instruction)
	);

	program_counter pc(
		.rst_n(rst_n),
		.clk(clk),
		.increment(pc_inc),
		.write_enable(pc_write_en),
		.write_value(C_bus),
		.read_enable(pc_read_en),
		.read_value(B_bus)
	);

	special_register_file special_regs(
		.rst_n(rst_n),
		.clk(clk),
		.reg_select(special_reg_sel),
		.read_enable(special_reg_read_en),
		.read_value(B_bus),
		.write_enable(special_reg_write_en),
		.write_value(C_bus),
		.inc_icount(inc_icount),
		.save_state(save_state),
		.restore_state(restore_state),
		.interrupt_mask(interrupt_mask),
		.exception_status(exception_status),
		.interrupt_status(interrupts),
		.interrupts_enabled(interrupts_enabled),
		.kernel_mode(kernel_mode),
		.user_base(user_base),
		.protection_table(protection_table)
	);

	control_unit cu(
		.reset_n(rst_n),
		.clk(clk),
		.instruction_reg(current_instruction),
		.mem_read(mem_read_en),
		.mem_write(mem_write_en),
		.check_mem(check_mem),
		.memory_violation(memory_violation),
		.ir_in(ir_write_en),
		.imm_16_out(imm_16_out),
		.imm_20_out(imm_20_out),
		.sign_extend(sign_extend_imm),
		.pc_in(pc_write_en),
		.pc_out(pc_read_en),
		.pc_inc(pc_inc),
		.a_out(reg_a_read_en),
		.b_out(reg_b_read_en),
		.c_in(reg_write_en),
		.sel_a(reg_a_sel),
		.sel_b(reg_b_sel),
		.sel_c(reg_write_sel),
		.temp_in(temp_write_en),
		.temp_out(temp_read_en),
		.alu_out(alu_out_en),
		.alu_start(alu_start),
		.alu_func(alu_func),
		.alu_done(alu_finished),
		.zero(zero),
		.div_zero(div_zero),
		.overflow(overflow),
		.special_reg_in(special_reg_write_en),
		.special_reg_out(special_reg_read_en),
		.special_reg_save_state(save_state),
		.special_reg_restore_state(restore_state),
		.inc_icount(inc_icount),
		.special_reg_sel(special_reg_sel),
		.exception_status(exception_status),
		.interrupts_enabled(interrupts_enabled),
		.kernel_mode(kernel_mode),
		.interrupts(interrupts),
		.int_mask(interrupt_mask)
	);

endmodule
module CPU(

	input rst_n,
	input clk,


	output write_enable_n,
	output read_enable_n,


	inout [31:0] data_bus,


	output [23:0] address_bus,


	output rom_cs_n,
	output ram_cs_n,
	output timer_cs_n,
	output parallel_cs_n,
	output serial1_cs_n,
	output serial2_cs_n,
	output aux1_cs_n,
	output aux2_cs_n,
	output sys_cs_n,


	input break_irq_n,
	input user_irq_n,
	input timer_irq_n,
	input parallel_irq_n,
	input serial1_irq_n,
	input serial2_irq_n,
	input aux1_irq_n,
	input aux2_irq_n,

	input rom_lock
 	);

 
 
 

	wire [31:0] A_bus;
	wire [31:0] B_bus;
	wire [31:0] C_bus;


	wire check_mem;
	wire kernel_mode;
	wire [19:0] mpu_address_out;
	wire [19:0] user_base;
	wire [19:0] protection_table;
	wire memory_violation;


	wire mem_read_en;
	wire mem_write_en;


	wire temp_read_en;
	wire temp_write_en;


	wire [4:0] alu_func;
	wire alu_start;
	wire alu_finished;
	wire alu_out_en;
	wire zero;
	wire overflow;
	wire div_zero;


	wire       reg_a_read_en;
	wire [3:0] reg_a_sel;
	wire       reg_b_read_en;
	wire [3:0] reg_b_sel;
	wire       reg_write_en;
	wire [3:0] reg_write_sel;


	wire ir_write_en;
	wire imm_16_out;
	wire imm_20_out;
	wire sign_extend_imm;
	wire [31:0] current_instruction;


	wire pc_inc;
	wire pc_write_en;
	wire pc_read_en;



	wire [3:0] special_reg_sel;
	wire       special_reg_read_en;
	wire       special_reg_write_en;
	wire       inc_icount;
	wire       save_state;
	wire       restore_state;
	wire [7:0] interrupt_mask;
	wire [3:0] exception_status;
	wire [7:0] interrupts;
	wire       interrupts_enabled;


	assign address_bus[23:20] = 4'h0;


	assign interrupts[0] = 0;
	assign interrupts[1] = ~user_irq_n;
	assign interrupts[2] = ~timer_irq_n;
	assign interrupts[3] = ~parallel_irq_n;
	assign interrupts[4] = ~serial1_irq_n;
	assign interrupts[5] = ~serial2_irq_n;
	assign interrupts[6] = ~aux1_irq_n;
	assign interrupts[7] = ~aux2_irq_n;
	

	memory_protection_unit mpu(
		.check_mem(check_mem),
		.user_mode(~kernel_mode),
		.address_in(B_bus[19:0]),
		.address_out(mpu_address_out),
		.user_base(user_base),
		.protection_table(protection_table),
		.load_data(C_bus),
		.memory_violation(memory_violation)
	);

	memory_interface mem_interface(
		.data_in(A_bus),
		.data_out(C_bus),
		.cpu_address(mpu_address_out),
		.mem_read(mem_read_en),
		.mem_write(mem_write_en),
		.rom_lock(rom_lock),
		.data_bus(data_bus),
		.address_bus(address_bus[19:0]),
		.serial1_cs_n(serial1_cs_n),
		.serial2_cs_n(serial2_cs_n),
		.parallel_cs_n(parallel_cs_n),
		.timer_cs_n(timer_cs_n),
		.ram_cs_n(ram_cs_n),
		.rom_cs_n(rom_cs_n),
		.aux1_cs_n(aux1_cs_n),
		.aux2_cs_n(aux2_cs_n),
		.sys_cs_n(sys_cs_n),
		.write_enable_n(write_enable_n),
		.read_enable_n(read_enable_n)
	);

	register temp_reg(
		.rst_n(rst_n),
		.clk(clk),
		.write_enable(temp_write_en),
		.write_value(C_bus),
		.read_enable(temp_read_en),
		.read_value(B_bus)
	);

	alu alu(
		.rst_n(rst_n),
		.clk(clk),
		.func(alu_func),
		.operand_a(A_bus),
		.operand_b(B_bus),
		.start(alu_start),
		.finished(alu_finished),
		.out_enable(alu_out_en),
		.out_bus(C_bus),
		.zero(zero),
		.overflow_out(overflow),
		.div_zero_out(div_zero)
	);

	register_file reg_file(
		.rst_n(rst_n),
		.clk(clk),
		.read_a_enable(reg_a_read_en),
		.read_a_select(reg_a_sel),
		.read_a_value(A_bus),
		.read_b_enable(reg_b_read_en),
		.read_b_select(reg_b_sel),
		.read_b_value(B_bus),
		.write_enable(reg_write_en),
		.write_select(reg_write_sel),
		.write_value(C_bus)
	);

	instruction_register ir(
		.rst_n(rst_n),
		.clk(clk),
		.write_enable(ir_write_en),
		.write_data(C_bus),
		.imm_16_out(imm_16_out),
		.imm_20_out(imm_20_out),
		.sign_extend(sign_extend_imm),
		.a_out(A_bus),
		.current_instruction(current_instruction)
	);

	program_counter pc(
		.rst_n(rst_n),
		.clk(clk),
		.increment(pc_inc),
		.write_enable(pc_write_en),
		.write_value(C_bus),
		.read_enable(pc_read_en),
		.read_value(B_bus)
	);

	special_register_file special_regs(
		.rst_n(rst_n),
		.clk(clk),
		.reg_select(special_reg_sel),
		.read_enable(special_reg_read_en),
		.read_value(B_bus),
		.write_enable(special_reg_write_en),
		.write_value(C_bus),
		.inc_icount(inc_icount),
		.save_state(save_state),
		.restore_state(restore_state),
		.interrupt_mask(interrupt_mask),
		.exception_status(exception_status),
		.interrupt_status(interrupts),
		.interrupts_enabled(interrupts_enabled),
		.kernel_mode(kernel_mode),
		.user_base(user_base),
		.protection_table(protection_table)
	);

	control_unit cu(
		.reset_n(rst_n),
		.clk(clk),
		.instruction_reg(current_instruction),
		.mem_read(mem_read_en),
		.mem_write(mem_write_en),
		.check_mem(check_mem),
		.memory_violation(memory_violation),
		.ir_in(ir_write_en),
		.imm_16_out(imm_16_out),
		.imm_20_out(imm_20_out),
		.sign_extend(sign_extend_imm),
		.pc_in(pc_write_en),
		.pc_out(pc_read_en),
		.pc_inc(pc_inc),
		.a_out(reg_a_read_en),
		.b_out(reg_b_read_en),
		.c_in(reg_write_en),
		.sel_a(reg_a_sel),
		.sel_b(reg_b_sel),
		.sel_c(reg_write_sel),
		.temp_in(temp_write_en),
		.temp_out(temp_read_en),
		.alu_out(alu_out_en),
		.alu_start(alu_start),
		.alu_func(alu_func),
		.alu_done(alu_finished),
		.zero(zero),
		.div_zero(div_zero),
		.overflow(overflow),
		.special_reg_in(special_reg_write_en),
		.special_reg_out(special_reg_read_en),
		.special_reg_save_state(save_state),
		.special_reg_restore_state(restore_state),
		.inc_icount(inc_icount),
		.special_reg_sel(special_reg_sel),
		.exception_status(exception_status),
		.interrupts_enabled(interrupts_enabled),
		.kernel_mode(kernel_mode),
		.interrupts(interrupts),
		.int_mask(interrupt_mask)
	);

endmodule