tc58128ft.v 1.28 KB
// wrapper to map to bb sim;
// cloned tc58512ft.v and TC58512FT.v to emulate smaller device;

module tc58128ft (
	io, cle, ale, ceb, reb, web, rbb, wpb, seb
);
	inout [7:0] io;
	input cle;
	input ale;
	input ceb;
	input reb;
	input web;
	inout rbb;
	input wpb;
	input seb;

	TC58128FT t ( io, ceb, web, reb, cle, ale, wpb, rbb );

        // shuttfle toshiba init file;

	integer addr;
	integer fl_addr;
	integer i;
	parameter FLASH_PAGES = 32*1024;

	initial
	begin
		$readmemh("External_File.txt", t.MEM);
		addr = (FLASH_PAGES-1)*1024;
		for(fl_addr = (FLASH_PAGES-1)*528; fl_addr >= 0; fl_addr = fl_addr - 528) begin
			for (i=1023; i>=0; i=i-1) 
				t.MEM[addr + i] = (i >= 528)? 8'bx : t.MEM[fl_addr + i];
			addr = addr - 1024;
		end

                repeat(20)  @(posedge vsim.sysclk);
                $display("%t DUMP 8 pages here ", $time);
        
                for (i=0; i<8; i=i+1) begin
                    $display("PAGE: %d", i);
                    for (addr=0; addr<1024; addr=addr+1) begin
                         $write("%2h ", t.MEM[i*1024 + addr]);
                         if ((addr & 8'h0f) == 8'h0f) 
                             $write("\n");
                    end
                    
                end
	end  
 

endmodule