Skip to content

Instantly share code, notes, and snippets.

@P4
Created March 27, 2015 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save P4/01ab313d8a04923bfe2d to your computer and use it in GitHub Desktop.
Save P4/01ab313d8a04923bfe2d to your computer and use it in GitHub Desktop.
module tester (
//wejscia kontrolne
input clk,
input reset_n,
//interfejs do debugowania
output [1:0] dbg_state,
output [3:0] dbg_r0,
output [3:0] dbg_r1,
output [3:0] dbg_pc
);
//interfejs pamiec-cpu
wire [3:0] mem_address;
wire [7:0] mem_data_r;
wire [7:0] mem_data_w;
wire mem_we;
wire ram_clk;
assign ram_clk = ~clk;
cpu x1 (
.clk(clk),
.reset_n(reset_n),
//interfejs pamieci
.mem_address(mem_address),
.mem_data_r(mem_data_r),
.mem_data_w(mem_data_w),
.mem_we(mem_we),
//interfejs debugowy
.dbg_state(dbg_state),
.dbg_r0(dbg_r0),
.dbg_r1(dbg_r1),
.dbg_pc(dbg_pc)
);
ram x2 (
.clock(ram_clk),
//port A pamieci - ma do niego dostep cpu
.address_a(mem_address), //adres wystawiany przez CPU
.data_a(mem_data_w), //dane wystawiane przez CPU
.wren_a(mem_we), //zezwolenie na zapis
.q_a(mem_data_r), //dane odczytane z pamieci przez CPU
//port B pamieci - tylko podglad zawartosci
.address_b(0), //nieuzywany
.data_b(0), //nieuzywany
.wren_b(0), //nieaktywny
);
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment