设计与验证verilog hdl

源代码在线查看: ram_basic.v

软件大小: 1828 K
上传用户: NJ_WK
关键词: verilog hdl
下载地址: 免注册下载 普通下载 VIP

相关代码

				module ram_basic (clk, CS, WR, addr, data_in, data_out, en);
				 input         clk;
				 input         CS;  //CS = 1, RAM enable
				 input         WR;  //WR =1 then WRite enable; WR = 0 then read enable
				 input         en;  //data_out enable, convert the data sequency
				 input  [5:0]  addr;
				 input  [7:0]  data_in;
				 output [7:0]  data_out;
				
				 reg [7:0] RAM8x64 [0:63];
				 reg [7:0] mem_data;
				 
				     always @ (posedge clk)
				         if (WR && CS) //WRite
				            RAM8x64 [addr] 				         else if (~WR && CS ) // read
				            mem_data 				         
				  assign data_out = (en)? mem_data[7:0] : {~mem_data[7], mem_data[6:0]};
				         
				
				
				endmodule			

相关资源