OpenCores
URL https://opencores.org/ocsvn/t6507lp/t6507lp/trunk

Subversion Repositories t6507lp

[/] [t6507lp/] [trunk/] [rtl/] [verilog/] [t6532.v] - Diff between revs 201 and 203

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 201 Rev 203
Line 42... Line 42...
////                                                                    ////
////                                                                    ////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
 
 
`include "timescale.v"
`include "timescale.v"
 
 
module t6532(clk, reset_n, io_lines, enable, rw_mem, address, data);
module t6532(clk, reset_n, io_lines, enable, mem_rw, address, data);
        parameter [3:0] DATA_SIZE = 4'd8;
        parameter [3:0] DATA_SIZE = 4'd8;
        parameter [3:0] ADDR_SIZE = 4'd10; // this is the *local* addr_size
        parameter [3:0] ADDR_SIZE = 4'd10; // this is the *local* addr_size
 
 
        localparam [3:0] DATA_SIZE_ = DATA_SIZE - 4'd1;
        localparam [3:0] DATA_SIZE_ = DATA_SIZE - 4'd1;
        localparam [3:0] ADDR_SIZE_ = ADDR_SIZE - 4'd1;
        localparam [3:0] ADDR_SIZE_ = ADDR_SIZE - 4'd1;
 
 
        input clk; // master clock signal, 1.19mhz
        input clk; // master clock signal, 1.19mhz
        input reset_n;
        input reset_n;
        input [15:0] io_lines; // inputs from the keyboard controller
        input [15:0] io_lines; // inputs from the keyboard controller
        input enable; // since the address bus is shared an enable signal is used
        input enable; // since the address bus is shared an enable signal is used
        input rw_mem; // read == 0, write == 1
        input mem_rw; // read == 0, write == 1
        input [ADDR_SIZE_:0] address; // system address bus
        input [ADDR_SIZE_:0] address; // system address bus
        inout [DATA_SIZE_:0] data; // controler <=> riot data bus
        inout [DATA_SIZE_:0] data; // controler <=> riot data bus
 
 
        reg [DATA_SIZE_:0] ram [8'hFF:8'h80]; // the ram itself. TODO: test the memory compiler
        reg [DATA_SIZE_:0] ram [8'hFF:8'h80]; // the ram itself. TODO: test the memory compiler
        reg [DATA_SIZE_:0] port_a;
        reg [DATA_SIZE_:0] port_a;
Line 75... Line 75...
        reg writing;
        reg writing;
        reg writing_at_timer;
        reg writing_at_timer;
 
 
        reg [DATA_SIZE_:0] data_drv; // wrapper for the data bus
        reg [DATA_SIZE_:0] data_drv; // wrapper for the data bus
 
 
        assign data = (rw_mem || !reset_n) ? 8'bZ : data_drv; // if under writing the bus receives the data from cpu, else local data.  
        assign data = (mem_rw || !reset_n) ? 8'bZ : data_drv; // if under writing the bus receives the data from cpu, else local data.  
 
 
        always @(posedge clk or negedge reset_n) begin // I/O handling
        always @(posedge clk or negedge reset_n) begin // I/O handling
                if (reset_n == 1'b0) begin
                if (reset_n == 1'b0) begin
                        port_a <= 8'h00;
                        port_a <= 8'h00;
                        port_b <= 8'h00;
                        port_b <= 8'h00;
Line 208... Line 208...
                reading = 1'b0;
                reading = 1'b0;
                writing = 1'b0;
                writing = 1'b0;
                writing_at_timer = 1'b0;
                writing_at_timer = 1'b0;
 
 
                if (enable && reset_n) begin
                if (enable && reset_n) begin
                        if (rw_mem == 1'b0) begin
                        if (mem_rw == 1'b0) begin
                                reading = 1'b1;
                                reading = 1'b1;
                        end
                        end
                        else begin
                        else begin
                                writing = 1'b1;
                                writing = 1'b1;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.