-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathchip.v
71 lines (61 loc) · 1.28 KB
/
chip.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module chip (
input I_RESET_WIRE,
output O_LED_R,
output O_LED_G,
output O_LED_B,
inout IO_ONE_WIRE
);
wire w_clk;
wire w_led_r;
wire w_led_g;
wire w_led_b;
wire w_owr_in;
wire w_owr_out;
reg reset = 1'b1;
reg [11:0] reset_count = 4095;
SB_HFOSC #(
.CLKHF_DIV("0b01")
) u_hfosc (
.CLKHFPU(1'b1),
.CLKHFEN(1'b1),
.CLKHF(w_clk)
);
// Keep the timer high for the first 4096 cycles
// To let the system stabilize
always @(posedge w_clk)
begin
if(reset_count > 0) begin
reset <= 1'b1;
reset_count <= reset_count - 1;
end else begin
reset <= 1'b0;
end
if(I_RESET_WIRE == 1'b1) begin
reset_count <= 4095;
end
end
// Temperature sensor
read_temp my_temp (
.i_clk(w_clk),
.i_rst(reset),
.o_led_r(w_led_r),
.o_led_g(w_led_g),
.o_led_b(w_led_b),
.i_owr(w_owr_in),
.o_owr(w_owr_out)
);
// Configure and connect the IO_ONE_WIRE pin
SB_IO #(
.PIN_TYPE(6'b 1010_01),
.PULLUP(1'b 0)
) io_buf_one_wire (
.PACKAGE_PIN(IO_ONE_WIRE),
.OUTPUT_ENABLE(w_owr_out),
.D_OUT_0(!w_owr_out),
.D_IN_0(w_owr_in)
);
// Connect up the registers to the LED wires
assign O_LED_R = w_led_r;
assign O_LED_G = w_led_g;
assign O_LED_B = w_led_b;
endmodule