Programming/VHDL2009. 12. 17. 17:25
두개 차이가 먼지 모르겠다. ㅋㅋ

The main distinction between FPGA and CPLD device architectures is that FPGAs are internally based on Look-up tables (LUTs) while CPLDs form the logic functions with sea-of-gates (e.g. sum of products).

[링크 : http://en.wikipedia.org/wiki/Complex_programmable_logic_device]


[링크 : http://en.wikipedia.org/wiki/Field-programmable_gate_array]

[링크 : http://en.wikipedia.org/wiki/Verilog]
[링크 : http://en.wikipedia.org/wiki/VHSIC_Hardware_Description_Language]

'Programming > VHDL' 카테고리의 다른 글

VHDL 문법 공부중 1  (0) 2017.12.10
VHDL 문법 관련  (0) 2017.12.08
VHDL 문법  (0) 2017.12.07
xilinx fpga with vhdl verilog  (0) 2017.12.02
FPGA / CPLD 차이..?  (0) 2017.11.09
Posted by 구차니
Programming/C Win32 MFC2009. 11. 25. 09:56
한번 시간내서 C++을 박살내고 C#을 해봐야 하는건가 ㅠ.ㅠ
아무튼,

class Class_name
{
public:
static const int i;
}

const int Class_name::i = 0;


이렇게 선언하면 클래스를 생성해도 공용으로 사용가능한 변수가 생긴다
(전역변수는 전역변수이되, 클래스 제한 전역변수일려나?)

[링크 : http://ask.nate.com/qna/view.html?n=3253901]

그냥 클래스 내부에서 public static 으로 변수 선언하면 클래스들 끼리 공유한다고 한다.




메소드는 공용으로 사용하는데, 메소드 내부 변수를 static으로 사용하면
클래스들끼리 공용하면 메소드들을 호출 할때 마다 값이 변화하므로, 의도하지 않은 값을 얻을 수 있다고 한다.

[링크 : http://ikpil.com/260]


const 의 의미
[링크 : http://www.cyworld.com/conaon/2965983]
Posted by 구차니
Programming/C Win32 MFC2009. 10. 29. 14:43
당연한 것 일수도 있지만, 조금은 황당했던 사건(!)은

static char array[]; 로 선언한 변수를
포인터로 다른 파일에 있는 함수로 넘겼을 경우, 읽지 못하고 죽어 버린다는 사실이다.

Static global variables are declared as "static" at the top level of a source file. Such variables are not visible outside the source file ("file scope"), unlike variables declared as "extern".

[링크 : http://en.wikipedia.org/wiki/Static_variable]


자세한건 나중에 다시 테스트..
Posted by 구차니
Programming/C Win32 MFC2009. 10. 27. 20:34
솔찍히 아직도 헷갈리는 녀석이 2차원 배열인데.. OTL
2차원 배열은 1차원 배열의 1차원 배열이다(응?)

array[5]는

array[0] array[1] array[2] array[3] array[4]
이고 이걸 2차원 배열로 표기하자면

array[0][0] array[0][1] array[0][2] array[0][3] array[0][4]
가 된다.(에러가 날지 안날지는 모르겠다)


아무튼
2차원 배열
array[3][2]은

array[0][0] array[0][1]
array[1][0] array[1][1]
array[2][0] array[2][1]

의 모양으로 된다.

즉,
array[행][열] 이다.


아래는 배열 주소 검증 프로그램 예제

#include "stdio.h"

int main(void)
{
        int i, j, t;
        int array[2][4], *parray;

        for( i = 0, t = 0; i < 2; i++ )
        {
                for( j = 0; j < 4; j++ )
                {
                        array[i][j] = t++;
                }
        }

        parray = &array[0][0];

        for( i = 0; i < 8; i++ )
                printf("array[%d] = %d\n", i, parray[i]);

        return 0;
}
[링크 : http://kldp.org/node/75640]


2010.09.15 추가


[링크 : http://www.cplusplus.com/doc/tutorial/arrays/]
Posted by 구차니
Programming/C Win32 MFC2009. 10. 9. 16:48
unix/linux에서는

#include <sys/stat.h>
int mkdir(const char *path, mode_t mode);

으로 디렉토리를 생성하는데

역시.. 윈도우답게, 윈도우에서는 _mkdir()을 지원한다고 한다.
문득 떠오르는 Sleep()과 sleep()의 차이점 ㄱ-

[링크 : http://msdn.microsoft.com/en-us/library/aa363855%28VS.85%29.aspx] CreateDirectory
[링크 : http://msdn.microsoft.com/en-us/library/2fkk4dzw%28VS.80%29.aspx] _mkdir
Posted by 구차니
Programming/Java2009. 9. 3. 22:01
java랑 안친해서 전혀 몰랐는데..
이런 충격적인 사실이 있었다니 -ㅁ-!


대충 검색해보니 unsigned - signed 변환에 예외가 많이 생기니까
차라리 전부 signed로 통일해버리면 깔끔해지기는 할듯 하다라는 이야기가 많이 나온다.

2.1.1 Primitive Data Types

Other than the primitive data types discussed here, everything in the Java programming language is an object. Even the primitive data types can be encapsulated inside library-supplied objects if required. The Java programming language follows C and C++ fairly closely in its set of basic data types, with a couple of minor exceptions. There are only three groups of primitive data types, namely, numeric types, character types, and Boolean types.

Numeric Data Types
Integer numeric types are 8-bit byte, 16-bit short, 32-bit int, and 64-bit long. The 8-bit byte data type in Java has replaced the old C and C++ char data type. Java places a different interpretation on the char data type, as discussed below.

There is no unsigned type specifier for integer data types in Java.

Real numeric types are 32-bit float and 64-bit double. Real numeric types and their arithmetic operations are as defined by the IEEE 754 specification. A floating point literal value, like 23.79, is considered double by default; you must explicitly cast it to float if you wish to assign it to a float variable.

2.1.2 Arithmetic and Relational Operators

All the familiar C and C++ operators apply. The Java programming language has no unsigned data types, so the >>> operator has been added to the language to indicate an unsigned (logical) right shift. Java also uses the + operator for string concatenation; concatenation is covered below in the discussion on strings.
[링크 : http://java.sun.com/docs/white/langenv/Simple.doc1.html]

  • byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.

  • short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.

  • int: The int data type is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive). For integral values, this data type is generally the default choice unless there is a reason (like the above) to choose something else. This data type will most likely be large enough for the numbers your program will use, but if you need a wider range of values, use long instead.

  • long: The long data type is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive). Use this data type when you need a range of values wider than those provided by int.

  • float: The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. As with the recommendations for byte and short, use a float (instead of double) if you need to save memory in large arrays of floating point numbers. This data type should never be used for precise values, such as currency. For that, you will need to use the java.math.BigDecimal class instead. Numbers and Strings covers BigDecimal and other useful classes provided by the Java platform.

  • double: The double data type is a double-precision 64-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. For decimal values, this data type is generally the default choice. As mentioned above, this data type should never be used for precise values, such as currency.

  • boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defined.

  • char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

Data Type Default Value (for fields)
byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char '\u0000'
String (or any object)   null
boolean false

[링크 : http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html ]


'Programming > Java' 카테고리의 다른 글

Java 에서 파일 목록 엳어오기  (0) 2011.10.29
netbeans 에서 코드 자동정렬  (0) 2011.10.29
Java용 폴더 다이얼로그  (0) 2011.10.28
netbeans IDE  (0) 2010.08.23
unit test - 단위 테스트  (0) 2010.08.18
Posted by 구차니
Programming/C Win32 MFC2009. 9. 2. 18:09

CEdit 컨트롤의 색상을 변경하기 위해서는 WM_CTLCOLOR을 이용한다.
일단 전역변수로 CBrush COLORREF 변수를 선언해준다.
그리고 나서 클래스 위저드에서 다이얼로그 자체의 WM_CTLCOLOR을 생성해준다.

이 녀석은 그리기 전에 메시지를 가로채서 색상을 설정해주는 역활을 한다고 한다.

OnInitDialog() 에서
    m_redcolor=RGB(255,0,0);                      // red
    m_bluecolor=RGB(0,0,255);                     // blue
    m_textcolor=RGB(255,255,255);                 // white text
    m_redbrush.CreateSolidBrush(m_redcolor);      // red background
    m_bluebrush.CreateSolidBrush(m_bluecolor);    // blue background
이런식으로 브러시와 색상을 미리 설정해준다.

그 다음에, OnCtlColor에서 GetDlgCtrlID()에 의해 분기를 쳐주면서
원하는 컨트롤의 ID에 연결해주면 원하는 색상으로 그려진다.

    pDC->SetBkColor(m_bluecolor);
    pDC->SetTextColor(m_textcolor);
    hbr = (HBRUSH) m_bluebrush;

위의 내용을 사용하면되며,
    SetBKColor()은 배경색상(기본값은 흰색)
    SetTextColor()은 글씨색상(기본값은 검은색)
을 변경해주게 된다.

브러시를 리턴함으로, 이 브러시를 이용하여 실제로 변경한 색상으로 그려주게 된다.


아래는 OnCtlColor의 기본 템플릿이다.
클래스위저드가 생성하면 // TODO 사이의 내용이 없으므로 불편하다.
HBRUSH CBarcodeDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	switch(nCtlColor)
	{
		case CTLCOLOR_EDIT:
		case CTLCOLOR_MSGBOX:
			switch (pWnd->GetDlgCtrlID())
			{
				default:
					break;
			}
			break;

		case CTLCOLOR_STATIC:
			switch (pWnd->GetDlgCtrlID())
			{
				default:
					break;
			}
			break;

		default:
			break;
	}
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}


[링크 : http://www.codeguru.com/Cpp/controls/editctrl/backgroundcolor/article.php/c3929/#more]
[링크 : http://mind444.tistory.com/64]
Posted by 구차니
Programming/C Win32 MFC2009. 8. 25. 17:17
EndDialog(); 혹은
PostMessage(WM_CLOSE,0,0); 을 쓰라고 한다

[링크 : http://www.codeguru.com/forum/showthread.php?t=60903]


PostMessage(WM_CLOSE,0,0)는 한번 나왔다가 사라지고
EndDialog()는 아무런 흔적없이 다이얼로그를 없앤다.
[링크 : http://msdn.microsoft.com/en-us/library/ms645472%28VS.85%29.aspx]

두가지 방법중에는 EndDialog() 추천

프로토 타입은
BOOL EndDialog(     
    HWND hDlg,
    INT_PTR nResult
);

이며 실제 사용시에는 EndDialog(0); 이렇게 해줘도 무방함
Posted by 구차니
Programming/C Win32 MFC2009. 8. 25. 16:41
전에는 몰랐는데, 이번에 발생한 문제이다...

Pre- 라는 말이 붙듯, 모든 입력을 우선적으로 가로채서 처리하게 되는 녀석이다.

예를 들어
1. 다이얼로그 메인 윈도우가 있고
2. 메인 윈도우에서 엔터시에 입력을 받도록 하고
3. MessageBox로 메시지를 띄운뒤
4. 메시지 박스를 없애기 위해 엔터를 치면
무한 루프에 빠지게 된다.

포커스로 그 컨트롤에서만 입력을 받도록 해놨지만,
메시지 박스가 발생하면서 엔터를 입력 받아도 포커스를 받아가지 않는지
PreTranslateMessage 에서 처리를 하면서
계속 엔터를 인식해서 메시지 루프에 꾸역꾸역 넣어준다...

빠져 나오려면 머.. 엔터가 아닌 스페이스로 하면 빠져는 나오지만,
이래저래 상쾌하지 못한 결과..

[링크 : http://msdn.microsoft.com/en-us/library/kkbhxcs2%28VS.80%29.aspx]
Posted by 구차니
Programming/C Win32 MFC2009. 8. 20. 17:55
원래 C스타일로 fopen()을 좋아하다가
MFC 답게 CFile 클래스로 하려는데.. 아래처럼 배를짼다.


해결방법 : 논리 OR 의 CFile::modeReadCFile::modeWrite 대신 CFile::modeReadWrite를 지정하십시오
현재상태 : 이 동작은 의도적으로입니다.

[링크 : http://support.microsoft.com/kb/181880]

의도적이란다... 뭥미?



사족 : 혹시 저기 확인 누르신분 손?
Posted by 구차니