diff options
Diffstat (limited to 'eater_cpu/eater_computer.sv')
| -rw-r--r-- | eater_cpu/eater_computer.sv | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/eater_cpu/eater_computer.sv b/eater_cpu/eater_computer.sv index f9104af..b93f289 100644 --- a/eater_cpu/eater_computer.sv +++ b/eater_cpu/eater_computer.sv @@ -2,6 +2,8 @@ `timescale 1us/1us +`include "eater_types.sv" + module eater_computer( // clock input input wire clk_in, @@ -38,23 +40,14 @@ wire [7:0] // PC is only 4 bit. wire [3:0] PC_in, PC_out; -logic - A_to_bus, bus_to_A, - B_to_bus, bus_to_B, - INS_to_bus, bus_to_INS, - RAM_to_bus, bus_to_RAM, - ALU_to_bus, - PC_to_bus, bus_to_PC, PC_count_en, - bus_to_MAR, - bus_to_OUT -; +CpuControlFlags flags; /* verilator public_off */ eater_register A ( .clk_in(clk_in), - .en_store_in(bus_to_A), - .en_output_in(A_to_bus), + .en_store_in(flags.A_in), + .en_output_in(flags.A_out), .data_in(bus), .bus_out(bus), .always_out(A_out) @@ -63,8 +56,8 @@ eater_register A ( eater_register B ( .clk_in(clk_in), - .en_store_in(bus_to_B), - .en_output_in(B_to_bus), + .en_store_in(flags.B_in), + .en_output_in(flags.B_out), .data_in(bus), .bus_out(bus), .always_out(B_out) @@ -73,8 +66,8 @@ eater_register B ( eater_register INS ( .clk_in(clk_in), - .en_store_in(bus_to_INS), - .en_output_in(INS_to_bus), + .en_store_in(flags.INS_in), + .en_output_in(flags.INS_out), .data_in(bus), .bus_out(), .always_out(INS_out) @@ -86,13 +79,13 @@ wire [7:0] INS_to_bus_interm = {4'b0, INS_out[3:0]}; zbuffer INS_to_bus_buffer ( .data_in(INS_to_bus_interm), - .en_output_in(INS_to_bus), + .en_output_in(flags.INS_out), .data_out(bus) ); eater_register MEM_ADR ( .clk_in(clk_in), - .en_store_in(bus_to_MAR), + .en_store_in(flags.MAR_in), .en_output_in(1'b0), .data_in(bus), .bus_out(), @@ -110,7 +103,7 @@ my_mem #( .DATA_DEPTH(16) ) RAM ( .clk_i(clk_in), - .write_en_i(bus_to_RAM), + .write_en_i(flags.RAM_in), // doesn't matter .read_en_i(), .r_read_addr(RAM_adr_in), @@ -122,13 +115,13 @@ my_mem #( zbuffer ram_to_bus_buffer ( .data_in(RAM_out), - .en_output_in(RAM_to_bus), + .en_output_in(flags.RAM_out), .data_out(bus) ); eater_alu alu ( .clk_in(clk_in), - .en_output_in(ALU_to_bus), + .en_output_in(flags.ALU_out), .A_in(A_out), .B_in(B_out), .subtract_n_add_in(1'b0), @@ -143,8 +136,8 @@ counter #( ) PC ( .clk_in(PC_clk_neg), .X_in(PC_in), - .st_store_X_in(bus_to_PC), - .count_enable_in(PC_count_en), + .st_store_X_in(flags.PC_in), + .count_enable_in(flags.PC_count), .counter_out(PC_out) ); @@ -152,14 +145,14 @@ assign PC_out_full = {4'b0, PC_out}; zbuffer PC_to_bus_buffer ( .data_in(PC_out_full), - .en_output_in(PC_to_bus), + .en_output_in(flags.PC_out), .data_out(bus) ); eater_register OUT ( .clk_in(clk_in), .data_in(bus), - .en_store_in(bus_to_OUT), + .en_store_in(flags.OUT_in), .en_output_in(1'b0), .bus_out(), .always_out(OUT_out) |
