Skip to content

Commit

Permalink
z80: Updating and fixing the host test program and memory addressing
Browse files Browse the repository at this point in the history
  • Loading branch information
gdevic committed Sep 12, 2014
1 parent d3f7f31 commit 74a59a1
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 85 deletions.
8 changes: 5 additions & 3 deletions host/toplevel/host.debug.sv
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ uart_io uart_io_( .*, .reset(reset_stable), .Address(A[15:8]), .Data(D[7:0]), .I
wire [7:0] RamData;
wire we;

assign D[7:0] = (A[15:8]=='0 && nMREQ==1 && nRD==1 && nWR==0) ? RamData : {8{1'bz}};
assign we = A[15:8]=='0 && nMREQ==1 && nRD==0 && nWR==1;
// 1K is addressable with bits [9:0]
// 1K *blocks* are selectable with bits [15:10]
assign D[7:0] = (A[15:10]=='0 && nMREQ==1 && nRD==1 && nWR==0) ? RamData : {8{1'bz}};
assign we = A[15:10]=='0 && nMREQ==1 && nRD==0 && nWR==1;

ram ram_( .address (A[9:0]), .clock (clk), .data (D[7:0]), .wren (we), .q (RamData[7:0]) );
ram ram_( .address(A[9:0]), .clock(clk), .data(D[7:0]), .wren(we), .q(RamData[7:0]) );

endmodule
8 changes: 5 additions & 3 deletions host/toplevel/host.sv
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ uart_io uart_io_( .*, .reset(!reset), .Address(A[15:8]), .Data(D[7:0]), .IORQ(nI
wire [7:0] RamData;
wire we;

assign D[7:0] = (A[15:8]=='0 && nMREQ==1 && nRD==1 && nWR==0) ? RamData : {8{1'bz}};
assign we = A[15:8]=='0 && nMREQ==1 && nRD==0 && nWR==1;
// 1K is addressable with bits [9:0]
// 1K *blocks* are selectable with bits [15:10]
assign D[7:0] = (A[15:10]=='0 && nMREQ==1 && nRD==1 && nWR==0) ? RamData : {8{1'bz}};
assign we = A[15:10]=='0 && nMREQ==1 && nRD==0 && nWR==1;

ram ram_( .address (A[9:0]), .clock (clk), .data (D[7:0]), .wren (we), .q (RamData[7:0]) );
ram ram_( .address(A[9:0]), .clock(clk), .data(D[7:0]), .wren(we), .q(RamData[7:0]) );

endmodule
Loading

0 comments on commit 74a59a1

Please sign in to comment.