📄 mcu.v
字号:
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:45:29 02/21/06
// Design Name:
// Module Name: mcu
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module mcu(mcu_ale, mcu_rd, mcu_wr, data, ledout, dial);
input mcu_ale; //synthesis attribute clock_buffer of mcu_ale is ibuf
input mcu_rd;
input mcu_wr; //synthesis attribute clock_buffer of mcu_wr is ibuf
inout [7:0] data;
output [7:0] ledout;
input [7:0] dial;
reg [7:0] ledout;
reg [7:0] din;
reg [7:0] dout;
reg [1:0] la; //锁存地址
always@(negedge mcu_ale )
begin
la<= data[1:0]; //锁存地址
end
always@(la)
begin
if(la==2'b00)
dout<=dial; //地址00分配给拨码开关
else
dout<=8'b00000000;
end
assign data =(!mcu_rd )&&(!mcu_ale)? dout : 8'bzzzzzzzz;
always @(negedge mcu_wr )
begin
if(la==2'b10) //地址10分配给led灯
ledout<=data;
end
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -