-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAHB2LED.v
43 lines (35 loc) · 927 Bytes
/
AHB2LED.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
`timescale 1ns / 1ps
module AHB2LED(
input wire HCLK,
input wire HRESETn,
input wire HSEL,
input wire HREADY,
input wire HWRITE,
input wire [31:0] HADDR,
input wire [31:0] HWDATA,
output wire HREADYOUT,
output wire [15:0] LED_OUT
);
assign HREADYOUT = 1'b1; // Always ready
reg [15:0] LED;
assign LED_OUT = LED;
reg HSEL_tmp;
reg [31:0] HADDR_tmp;
reg HWRITE_tmp;
always @(posedge HCLK or negedge HRESETn) begin
if(!HRESETn) begin
HADDR_tmp <= 32'h0000_0000;
HWRITE_tmp <= 1'b0;
HSEL_tmp <= 1'b0;
end else if(HREADY) begin
HADDR_tmp <= HADDR;
HWRITE_tmp <= HWRITE;
HSEL_tmp <= HSEL;
end
end
always @(posedge HCLK) begin
if(HWRITE_tmp & HSEL_tmp)
LED = HWDATA[15:0];
// HRDATA = {(32-8)'h000000, LED[7:0]};
end
endmodule