Last active
January 26, 2016 15:11
-
-
Save cfelton/3b61802c7b15b130f1d7 to your computer and use it in GitHub Desktop.
Revisions
-
cfelton revised this gist
Jan 26, 2016 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,16 @@ @always_seq(clock.posedge, reset=reset) def beh_sop(): # tap update loop xd[0].next = x for ii in range(1, len(h)): xd[ii].next = xd[ii-1] # sum-of-products loop sop = 0 for ii in range(len(h)): c = h[ii] sop = sop + (c * xd[ii]) # scale the sum of products to the # output range (truncate) y.next = sop >> scale -
cfelton revised this gist
Jan 26, 2016 . No changes.There are no files selected for viewing
-
cfelton revised this gist
Jan 26, 2016 . No changes.There are no files selected for viewing
-
cfelton created this gist
Jan 26, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ @always_seq(clock.posedge, reset=reset) def beh_sop(): # tap update loop xd[0].next = x for ii in range(1, len(h)): xd[ii].next = xd[ii-1] # sum-of-products loop sop = 0 for ii in range(len(h)): c = h[ii] sop = sop + (c * xd[ii]) # scale the sum of products to the # output range (truncate) y.next = sop >> scale This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ def taps(x, N): return [x] if N <= 1 else [x] + taps(Reg(x), N-1) w1 = sum([x*h for x, h in zip(taps(Reg(x), len(hs)), hs)]) w2 = w1 >> len(x)/2