From 08858e963d2158f1eb0a45ffa699856f5ad602b4 Mon Sep 17 00:00:00 2001 From: sleary78 Date: Mon, 23 May 2016 20:39:26 +0100 Subject: [PATCH] updates for boilerplates --- cores/archie/bench/sound/Makefile | 2 +- cores/archie/bench/sound/conv.c | 72 ++++++++++++++------ cores/archie/bench/sound/mu255.c | 33 +++++++-- cores/archie/bench/sound/vidc_audio.cpp | 28 ++++++++ cores/archie/bench/system/archimedes_top.cpp | 27 ++++++++ 5 files changed, 134 insertions(+), 28 deletions(-) diff --git a/cores/archie/bench/sound/Makefile b/cores/archie/bench/sound/Makefile index 512cdcb..605da4a 100644 --- a/cores/archie/bench/sound/Makefile +++ b/cores/archie/bench/sound/Makefile @@ -21,4 +21,4 @@ conv: clean:: rm -rf *.o $(TARGET) llama.ac *.vcd conv mu255 distclean:: clean - rm -rf *~ *.mif *.lu *.ul *.vcd *.txt \ No newline at end of file + rm -rf *~ *.mif *.lu *.ul *.vcd *.txt *.orig diff --git a/cores/archie/bench/sound/conv.c b/cores/archie/bench/sound/conv.c index 0e1a721..15b105e 100644 --- a/cores/archie/bench/sound/conv.c +++ b/cores/archie/bench/sound/conv.c @@ -1,3 +1,31 @@ +/* conv.c + + Copyright (c) 2015, Stephen J. Leary + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include #include @@ -6,30 +34,30 @@ int main (int argc, char **argv) unsigned char wp; while (fread(&wp,sizeof(unsigned char),1,stdin) > 0) { - /* - * In the following loop we convert 4 bytes at once because - * it's all pure bit twiddling: there is no arithmetic to - * cause overflow/underflow or other such nasty effects. Each - * byte is converted using the algorithm: - * - * output = ~(((input >> 7) & 0x01) | - * ((input << 1) & 0xFE) ) - * - * i.e. we rotate the byte left by 1 then bitwise complement - * the result. On ARM the actual conversion (not including - * the load & store) works out to take all of 4 S-cycles, and - * since we are doing 4 bytes at once this really ain't bad! - * Note that we don't worry about alignment on any odd bytes - * at the end of the buffer (unlikely anyway), we just convert - * all 4 bytes - the right number still get written. - */ - unsigned int xm = 0x01010101; + /* + * In the following loop we convert 4 bytes at once because + * it's all pure bit twiddling: there is no arithmetic to + * cause overflow/underflow or other such nasty effects. Each + * byte is converted using the algorithm: + * + * output = ~(((input >> 7) & 0x01) | + * ((input << 1) & 0xFE) ) + * + * i.e. we rotate the byte left by 1 then bitwise complement + * the result. On ARM the actual conversion (not including + * the load & store) works out to take all of 4 S-cycles, and + * since we are doing 4 bytes at once this really ain't bad! + * Note that we don't worry about alignment on any odd bytes + * at the end of the buffer (unlikely anyway), we just convert + * all 4 bytes - the right number still get written. + */ + unsigned int xm = 0x01010101; - unsigned char ss = wp; - wp = ~(((ss >> 7) & xm) | (~xm & (ss << 1))); + unsigned char ss = wp; + wp = ~(((ss >> 7) & xm) | (~xm & (ss << 1))); - - fwrite(&wp,sizeof(unsigned char),1,stdout); + + fwrite(&wp,sizeof(unsigned char),1,stdout); } return 0; diff --git a/cores/archie/bench/sound/mu255.c b/cores/archie/bench/sound/mu255.c index 8c508ef..dfeed9e 100644 --- a/cores/archie/bench/sound/mu255.c +++ b/cores/archie/bench/sound/mu255.c @@ -1,12 +1,35 @@ +/* mu255.c + + Copyright (c) 2015, Stephen J. Leary + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include #include #include -short ulaw2linear(unsigned char ulawbyte) -{ - -} - int main(int argc, char **argv) { diff --git a/cores/archie/bench/sound/vidc_audio.cpp b/cores/archie/bench/sound/vidc_audio.cpp index 083a4e5..2287987 100644 --- a/cores/archie/bench/sound/vidc_audio.cpp +++ b/cores/archie/bench/sound/vidc_audio.cpp @@ -1,3 +1,31 @@ +/* vidc_audio.cpp + + Copyright (c) 2015, Stephen J. Leary + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include // Defines common routines #include "Vvidc_audio.h" #include "verilated_vcd_c.h" diff --git a/cores/archie/bench/system/archimedes_top.cpp b/cores/archie/bench/system/archimedes_top.cpp index c4b7896..d07b040 100644 --- a/cores/archie/bench/system/archimedes_top.cpp +++ b/cores/archie/bench/system/archimedes_top.cpp @@ -1,3 +1,30 @@ +/* archimedes_top.cpp + + Copyright (c) 2015, Stephen J. Leary + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include // Defines common routines #include "Varchimedes_top.h"