Capsim Block Documentation
counter with QA connected to CKB
Port | Type | Name | |
---|---|---|---|
0 | float | cka | |
1 | float | r01 | |
2 | float | r02 |
Port | Type | Name | |
---|---|---|---|
0 | float | qa | |
1 | float | qb | |
2 | float | qc | |
3 | float | qd |
Num | Type | Name | Initial Value | Description |
---|---|---|---|---|
0 | int | count_val | 0 |
int samples; int in_r01; int in_r02; |
---|
for(samples = MIN_AVAIL(); samples>0; --samples) { IT_IN(0); IT_IN(1); IT_IN(2); in_r01 = r01(0); in_r02 = r02(0); if(in_r01 == 0 || in_r02 == 0) { if(cka(0) == 0.0 && cka(1) == 1.0) { ++ count_val; if(count_val == 16) count_val =0; } } else { count_val = 0; } if(IT_OUT(0) ) { KrnOverflow("sn74ls93",0); return(99); } qa(0) = count_val & 1; if(IT_OUT(1) ) { KrnOverflow("sn74ls93",1); return(99); } qb(0) = (count_val & 2) >> 1; if(IT_OUT(2) ) { KrnOverflow("sn74ls93",2); return(99); } qc(0) = (count_val & 4) >> 2; if(IT_OUT(3)) { KrnOverflow("sn74ls93",3); return(99); } qd(0) = (count_val & 8) >> 3; } return(0); |
---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks) Copyright (C) 1989-2017 Silicon DSP Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.silicondsp.com Silicon DSP Corporation Las Vegas, Nevada */ |
---|
/* sn74ls93.s: counter with QA connected to CKB parameters: none inputs: cka, clock input note: no ckb input because ckb connected to qa r01, reset 1 r02, reset 2 note: if r01=r02=1 all outputs are 0 outputs: qa, qb, qc, and qd |
---|