-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'clock-crossing' into tomu
- Loading branch information
Showing
24 changed files
with
1,460 additions
and
310 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
language: python | ||
|
||
jobs: | ||
include: | ||
- stage: test | ||
python: 2.7 | ||
env: TOXENV=py27 | ||
name: "Python 2.7" | ||
- python: 3.4 | ||
env: TOXENV=py34 | ||
name: "Python 3.4" | ||
- python: 3.5 | ||
env: TOXENV=py35 | ||
name: "Python 3.5" | ||
- python: 3.6 | ||
env: TOXENV=py36 | ||
name: "Python 3.6" | ||
- stage: deploy | ||
python: 3.6 | ||
name: "Upload dev version to PyPi" | ||
script: ./.push-to-pypi.sh | ||
|
||
stages: | ||
- test | ||
- name: deploy | ||
if: branch = master | ||
|
||
install: | ||
- git fetch --tags | ||
- cd programmer | ||
- pip install --upgrade pip | ||
- pip install --upgrade tox | ||
- pip install --upgrade setuptools | ||
- pip install --upgrade setuptools_scm | ||
- pip install --upgrade wheel | ||
- pip install --upgrade twine | ||
|
||
script: | ||
- tox | ||
|
||
notifications: | ||
email: false | ||
|
||
git: | ||
depth: false |
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
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,53 @@ | ||
module strobe( | ||
input clk_in, | ||
input clk_out, | ||
input strobe_in, | ||
output strobe_out, | ||
input [WIDTH-1:0] data_in, | ||
output [WIDTH-1:0] data_out | ||
); | ||
parameter WIDTH = 1; | ||
parameter DELAY = 2; // 2 for metastability, larger for testing | ||
|
||
`define CLOCK_CROSS | ||
`ifdef CLOCK_CROSS | ||
reg flag; | ||
reg prev_strobe; | ||
reg [DELAY:0] sync; | ||
reg [WIDTH-1:0] data; | ||
|
||
// flip the flag and clock in the data when strobe is high | ||
always @(posedge clk_in) begin | ||
//if ((strobe_in && !prev_strobe) | ||
//|| (!strobe_in && prev_strobe)) | ||
flag <= flag ^ strobe_in; | ||
|
||
if (strobe_in) | ||
data <= data_in; | ||
|
||
prev_strobe <= strobe_in; | ||
end | ||
|
||
// shift through a chain of flipflop to ensure stability | ||
always @(posedge clk_out) | ||
sync <= { sync[DELAY-1:0], flag }; | ||
|
||
assign strobe_out = sync[DELAY] ^ sync[DELAY-1]; | ||
assign data_out = data; | ||
`else | ||
assign strobe_out = strobe_in; | ||
assign data_out = data_in; | ||
`endif | ||
endmodule | ||
|
||
|
||
module dflip( | ||
input clk, | ||
input in, | ||
output out | ||
); | ||
reg [2:0] d; | ||
always @(posedge clk) | ||
d <= { d[1:0], in }; | ||
assign out = d[2]; | ||
endmodule |
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
Oops, something went wrong.