"Peter" <moocowmoo@newprovidence.demon.co.uk> wrote:>Anybody else old enough to have worked on a machine with a 24 bit word and a >6 bit char? The first machine I learned assembler on was like that. With >only 6 bits something had to give, and so it couldn't use lower case >letters.No, I started on core memory, but never got realy close to odd wordlength (did some high-level programming with 60 bit words, but don't remember the size of a char - it was academic) until the early 90's on an AD DSP with 24 bit word's. I settled on packed 6 bit chars with a teletype-like upper/lowercase escape sequence in an external display. Andreas -- "My name is Dump, Core Dump"
size of a byte and int?
Started by ●January 25, 2005
Reply by ●January 25, 20052005-01-25
Reply by ●January 25, 20052005-01-25
On Tue, 25 Jan 2005 21:26:27 GMT, Jonathan Kirwan <jkirwan@easystreet.com> wrote:>On 25 Jan 2005 15:38:47 GMT, Grant Edwards <grante@visi.com> wrote: > >>Common sense is often wrong. As yours seems to be in this >>case. I've worked on architectures where a byte (a-la "C") was >>32 bits. > >To up this, think PDP-10. 36 bits, unless using very special pointers to packed >structures of five 7-bit ASCII, with a spare bit in the word. But that doesn't >fit too well with C.Wouldn't work. A byte (in C) must be at least 8 bits wide. I used to work on a Univac 1100/80, which also had a 36-bit word. Each word held six 6-bit (FIELDATA) characters, or four 9-bit (quarter-word) ASCII characters. The latter would work for C, though pointer arithemetic might be, um, painful. FWIW, the Univac never had a C compiler when I was working with it. FORTRAN 77, Pascal, PL/I, COBOL, SNOBOL, Lisp, GPSS, Prolog, and many others I'm forgetting now, but no C. Regards, -=Dave -- Change is inevitable, progress is not.
Reply by ●January 25, 20052005-01-25
On 25 Jan 2005 21:59:28 GMT, Grant Edwards <grante@visi.com> wrote:>On 2005-01-25, Peter <moocowmoo@newprovidence.demon.co.uk> wrote: > >> Anybody else old enough to have worked on a machine with a 24 >> bit word and a 6 bit char? > >No, but I did some homework assignments on a machine with a 60 >bit word and a 6 bit char.As I mentioned up-thread: 36-bit word, 6-bit character (most often -- wider character encodings could be used). Regards, -=Dave -- Change is inevitable, progress is not.
Reply by ●January 25, 20052005-01-25
On Tue, 25 Jan 2005 17:04:41 -0500, Roberto Waltman <usenet@rwaltman.net> wrote:>I once ported the original Small-C compiler to an HP-2113 mini. (May >not be the right model number.) This one was an "advanced model", it >had a couple of index registers and could address individual bytes. >(No stack pointer, of course)I worked on a timeshared BASIC for the HP-2114 and HP-2116. I don't recall a 2113, though. My experience was with the 2114, 2116, and 21MX. Subroutines were handled by poking out the first word with the return address and using a jump indirect through it to return to the caller. No stacks, as you say. Jon
Reply by ●January 25, 20052005-01-25
On 25 Jan 2005 19:38:14 GMT, Richard <RichardRapier@netscape.net> wrote:>So, in a bit addressable processor, it's 1 bit? Certainly not in any >implementation I've seen.TI made some very interesting graphics processors about 15 years ago, the 34010 and 34020. All their memory was bit-addressable and they had an excellent C compiler, but with the quirk that the sizeof an 8-bit char was 8, not 1. This was the source of many bugs. -- Jim McGinnis
Reply by ●January 25, 20052005-01-25
On Tue, 25 Jan 2005 16:08:07 +0530, "Neo" <timeless_illusion@yahoo.com> wrote in comp.arch.embedded:> > "Peter Nilsson" <airia@acay.com.au> wrote in message > news:1106646608.010225.80650@z14g2000cwz.googlegroups.com... > > 42Bastian Schick wrote: > [-snip-] > > C99 introduced the intN_t types to cater for programs which > > do rely on precise width twos complement integer types, > > however programs which make use of them are not strictly > > conforming. > > > > -- > > Peter > > > Why not conforming? Then why does the std. defines these? > -Neo >An example is the TMS320C5402 you are using, or the TMS320F2812 that is one of the processors I am working with these days. They can't provide an exact width int8_t or uint8_t type, because the processor does not provide types with exactly that many bits. But it can support all of the least n bits types, and fastest n bits types. Here is a <stdint.h> header that I wrote for use with the TI 2812 and Code Composer Studio, it will probably work with your 5402. Try copying it into the compiler include directory, where headers like <stdio.h>, <string.h>, and so on, are. And as another poster suggested, do a Google search for the N869 draft of the C standard and read up on the integer types and this header. Copy the text between the lines into an editor and save as stdint.h. =================================================== /*************************************************************************************/ /** \file stdint.h * type definitions and macros for the subset of C99's stdint.h types * that Code Composer Studio for the TMS320C2812 DSP supports * * \date 15-Aug-2003 * * \author Jack Klein * * \b Notes: \n * Note: not all C99 integer types are supported on this * platform, in particular, no 8 bit types at all, and no 64 * bit types * *************************************************************************************/ #ifndef H_STDINT #define H_STDINT /* 7.18.1.1 */ /* exact-width signed integer types */ typedef signed int int16_t; typedef signed long int32_t; /* exact-width unsigned integer types */ typedef unsigned int uint16_t; typedef unsigned long uint32_t; /* 7.18.1.2 */ /* smallest type of at least n bits */ /* minimum-width signed integer types */ typedef signed int int_least8_t; typedef signed int int_least16_t; typedef signed long int_least32_t; /* minimum-width unsigned integer types */ typedef unsigned int uint_least8_t; typedef unsigned int uint_least16_t; typedef unsigned long uint_least32_t; /* 7.18.1.3 */ /* fastest minimum-width signed integer types */ typedef signed int int_fast8_t; typedef signed int int_fast16_t; typedef signed long int_fast32_t; /* fastest minimum-width unsigned integer types */ typedef unsigned int uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned long uint_fast32_t; /* 7.18.1.4 integer types capable of holding object pointers */ typedef signed long intptr_t; typedef unsigned long uintptr_t; /* 7.18.1.5 greatest-width integer types */ typedef signed long intmax_t; typedef unsigned long uintmax_t; #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) /* 7.18.2.1 */ /* maximum values of exact-width signed integer types */ #define INT16_MAX 32767 #define INT32_MAX 2147483647L /* minimum values of exact-width signed integer types */ #define INT16_MIN (-INT16_MAX-1) #define INT32_MIN (-INT32_MAX-1) /* -2147483648 is unsigned */ /* maximum values of exact-width unsigned integer types */ #define UINT16_MAX 65535U #define UINT32_MAX 4294967295UL /* 7.18.2.2 */ /* maximum values of minimum-width signed integer types */ #define INT_LEAST8_MAX 32767 #define INT_LEAST16_MAX 32767 #define INT_LEAST32_MAX 2147483647L /* minimum values of minimum-width signed integer types */ #define INT_LEAST8_MIN (-INT_LEAST8_MAX-1) #define INT_LEAST16_MIN (-INT_LEAST16_MAX-1) #define INT_LEAST32_MIN (-INT_LEAST32_MAX-1) /* maximum values of minimum-width unsigned integer types */ #define UINT_LEAST8_MAX 65535U #define UINT_LEAST16_MAX 65535U #define UINT_LEAST32_MAX 4294967295UL /* 7.18.2.3 */ /* maximum values of fastest minimum-width signed integer types */ #define INT_FAST8_MAX 32767 #define INT_FAST16_MAX 32767 #define INT_FAST32_MAX 2147483647L /* minimum values of fastest minimum-width signed integer types */ #define INT_FAST8_MIN (-INT_FAST8_MAX-1) #define INT_FAST16_MIN (-INT_FAST16_MAX-1) #define INT_FAST32_MIN (-INT_FAST32_MAX-1) /* maximum values of fastest minimum-width unsigned integer types */ #define UINT_FAST8_MAX 65535U #define UINT_FAST16_MAX 65535U #define UINT_FAST32_MAX 4294967295UL /* 7.18.2.4 */ /* maximum value of pointer-holding signed integer type */ #define INTPTR_MAX 2147483647L /* minimum value of pointer-holding signed integer type */ #define INTPTR_MIN (-INTPTR_MAX-1) /* maximum value of pointer-holding unsigned integer type */ #define UINTPTR_MAX 4294967295UL /* 7.18.2.5 */ /* maximum value of greatest-width signed integer type */ #define INTMAX_MAX 2147483647L /* minimum value of greatest-width signed integer type */ #define INTMAX_MIN (-INTMAX_MAX-1) /* maximum value of greatest-width unsigned integer type */ #define UINTMAX_MAX 4294967295UL /* 7.18.3 */ /* limits of ptrdiff_t */ #define PTRDIFF_MAX 2147483647L #define PTRDIFF_MIN (-PTRDIFF_MAX-1) /* limits of sig_atomic_t */ #define SIG_ATOMIC_MAX 2147483647L #define SIG_ATOMIC_MIN (-SIG_ATOMIC_MAX-1) #endif /* __STDC_LIMIT_MACROS */ #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* 7.18.4.1 macros for minimum-width integer constants */ #define INT16_C(x) (x) #define INT32_C(x) (x ## l) #define UINT16_C(x) (x ## u) #define UINT32_C(x) (x ## ul) /* 7.18.4.2 macros for greatest-width integer constants */ #define INTMAX_C(x) (x ## l) #define UINTMAX_C(x) (x ## ul) #endif /* __STDC_CONSTANT_MACROS */ #endif /* __stdint_h */ /* end of stdint.h */ =================================================== -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
Reply by ●January 25, 20052005-01-25
Jack Klein <jackklein@spamcop.net> writes: [...]> An example is the TMS320C5402 you are using, or the TMS320F2812 that > is one of the processors I am working with these days. They can't > provide an exact width int8_t or uint8_t type, because the processor > does not provide types with exactly that many bits.Strictly speaking, a C compiler for the TMS320C5402 or TMS320F2812 could provide exact width int8_t and uint8_t types (and make CHAR_BIT==8). It would have to generate extra code to extract and store 8-bit quantities within 16-bit words, and it would need to implement a special pointer format that indicates which octet within a word it points to, as well as the address of the word itself. (This would be similar to the way Cray's C compiler implements CHAR_BIT==8 on 64-bit vector machines.) This would almost certainly not be worth the effort -- which I suppose is close enough to "can't" for practical purposes. A related, and actually realistic, point is that C99, which requires 64-bit integers, can be implemented on hardware that doesn't support 64-bit types. The compiler just has to do some extra work to compose 64-bit operations from the available 32-bit operations. -- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> We must do something. This is something. Therefore, we must do this.
Reply by ●January 26, 20052005-01-26
Andreas Hadler wrote:> "Peter" <moocowmoo@newprovidence.demon.co.uk> wrote: > >> Anybody else old enough to have worked on a machine with a 24 bit >> word and a 6 bit char? The first machine I learned assembler on >> was like that. With only 6 bits something had to give, and so it >> couldn't use lower case letters. > > No, I started on core memory, but never got realy close to odd > wordlength (did some high-level programming with 60 bit words, > but don't remember the size of a char - it was academic) until > the early 90's on an AD DSP with 24 bit word's. I settled on > packed 6 bit chars with a teletype-like upper/lowercase escape > sequence in an external display.The SDS 910 etc. maybe (later the XDS). Scientific Data Systems sold out to Xerox. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson
Reply by ●January 26, 20052005-01-26
On 25 Jan 2005 15:38:47 GMT, Grant Edwards <grante@visi.com> wrote:>On 2005-01-25, 42Bastian Schick <bastian42@yahoo.com> wrote: >> On Tue, 25 Jan 2005 13:11:04 +0530, "Neo" >><timeless_illusion@yahoo.com> wrote: >> >>>Hi All, >>> >>>Is that true that size of a byte not necessarily 8-bit? >> >> I think common sense is that a byte is nowadays 8 bit. > >Common sense is often wrong. As yours seems to be in this >case. I've worked on architectures where a byte (a-la "C") was >32 bits.Maybe, or even sure, but if you read MBytes, KBytes etc. do you honestly thing in 32-bit bytes ?> >> That's it, they speak of words avoiding the term byte. > >The OP is asking about C. In C, 'byte' has a very specific >definition.Didn't know that C defines the term byte. -- 42Bastian Do not email to bastian42@yahoo.com, it's a spam-only account :-) Use <same-name>@monlynx.de instead !
Reply by ●January 26, 20052005-01-26
>> A reason, to define __u8,__u16,__u32 etc. (or the like) depending on >> the cpu and/or compiler. > >Leading underscores are for the implementation, not application programs.Eh, what do you mean by implementation ? And what is an application in this regard ? Is a TCP/IP stack an application in this sense ? I am confused ! -- 42Bastian Do not email to bastian42@yahoo.com, it's a spam-only account :-) Use <same-name>@monlynx.de instead !