Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastien Bourdeauducq
committed
Dec 16, 2011
1 parent
738b45d
commit 411e1af
Showing
6 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from functools import partial | ||
|
||
from migen.fhdl.structure import * | ||
|
||
class Inst: | ||
def __init__(self): | ||
d = partial(declare_signal, self) | ||
d("trigger_reset") | ||
d("sys_rst") | ||
d("ac97_rst_n") | ||
d("videoin_rst_n") | ||
d("flash_rst_n") | ||
self._inst = Instance("m1reset", | ||
[("sys_rst", self.sys_rst), | ||
("ac97_rst_n", self.ac97_rst_n), | ||
("videoin_rst_n", self.videoin_rst_n), | ||
("flash_rst_n", self.flash_rst_n)], | ||
[("trigger_reset", self.trigger_reset)], | ||
clkport="sys_clk") | ||
|
||
def get_fragment(self): | ||
return Fragment(instances=[self._inst], | ||
pads={self.ac97_rst_n, self.videoin_rst_n, self.flash_rst_n}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Milkymist-NG SoC | ||
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
module m1reset( | ||
input sys_clk, | ||
input trigger_reset, | ||
|
||
output reg sys_rst, | ||
output ac97_rst_n, | ||
output videoin_rst_n, | ||
output flash_rst_n | ||
); | ||
|
||
reg [19:0] rst_debounce; | ||
initial rst_debounce <= 20'hFFFFF; | ||
initial sys_rst <= 1'b1; | ||
always @(posedge sys_clk) begin | ||
if(trigger_reset) | ||
rst_debounce <= 20'hFFFFF; | ||
else if(rst_debounce != 20'd0) | ||
rst_debounce <= rst_debounce - 20'd1; | ||
sys_rst <= rst_debounce != 20'd0; | ||
end | ||
|
||
assign ac97_rst_n = ~sys_rst; | ||
assign videoin_rst_n = ~sys_rst; | ||
|
||
/* | ||
* We must release the Flash reset before the system reset | ||
* because the Flash needs some time to come out of reset | ||
* and the CPU begins fetching instructions from it | ||
* as soon as the system reset is released. | ||
* From datasheet, minimum reset pulse width is 100ns | ||
* and reset-to-read time is 150ns. | ||
*/ | ||
|
||
reg [7:0] flash_rstcounter; | ||
initial flash_rstcounter <= 8'd0; | ||
always @(posedge sys_clk) begin | ||
if(trigger_reset) | ||
flash_rstcounter <= 8'd0; | ||
else if(~flash_rstcounter[7]) | ||
flash_rstcounter <= flash_rstcounter + 8'd1; | ||
end | ||
|
||
assign flash_rst_n = flash_rstcounter[7]; | ||
|
||
endmodule |