Day 1 - Hex 단위, Data Type
·
IDEC 교육/Embedded C
2진수 & 16진수기본 단위2¹⁰ (1K) = 0x 4002¹² (4K) = 0x 10002¹⁶ (64K) = 0x 100002¹⁷ (128K) = 0x 200002²⁰ (1M) = 0x 1000002³⁰ (1G) = 0x 400000002⁴⁰ (1T) = 0x100000000추가 예시50K = 32K + 16K + 2K = 0x8000 + 0x4000 + 0x800 = 0xC800 100K = 64K + 32K + 4K = 0x10000 + 0xC800 + 0x1000 = 0x1D80050K = 32K + 16K + 2K = 0x8000 + 0x4000 + 0x800 = 0xC800 100K = 64K + 32K + 4K = 0x10000 + 0xC8..
Day 1 - Variable의 선언 vs 정의
·
IDEC 교육/Embedded C
Declare vs Define선언: Type을 Comiler에게 알려주는 역할 (메모리 할당 X)extern int a;정의: 변수명 지정으로 실체화 (메모리 할당 O)int a;
Day 1 - Keil Settings & Global, Local Variable
·
IDEC 교육/Embedded C
Keil ToolProject SettingsTarget SettingsAddress of Variablemain.c#include #include "ARMCM3.h"#include "core_cm3.h"int gVar;int fputc(int c, FILE * fp){ ITM_SendChar(c); return c;}void MyFunc(){ int a, b; printf("%#010x \r\n", (int)&gVar); printf("%#010x, %#010x \r\n", (int)&a, (int)&b); return ;}void MyFunc2(){ MyFunc(); return ;}int main(){ printf("%#010x \r\n", (int)&gVar); MyFunc(); MyFun..
HDLBits - 깃헙
·
HDLBits
https://github.com/Zi-Yoon/HDLBits GitHub - Zi-Yoon/HDLBits: Solving HDLBitsSolving HDLBits . Contribute to Zi-Yoon/HDLBits development by creating an account on GitHub.github.com 글쓸 만큼 체력이 여유롭지는 않아서 시간날때 풀고 올리기만 하고있다.. ㅠㅜ
HDLBits - Module
·
HDLBits/Verilog
Moudle 선언 방법으로 instance하는 문제!그림처럼 mod_a가 이미 선언 되어있다고 가정하고 mod_a를 instance하면 된다.나는 By Name 방식으로 불러서 쓰는 것이 좀더 명확하다고 생각해서 항상 그렇게 한다.module top_module ( input a, input b, output out ); mod_a U_mod_a ( .out(out), .in1(a), .in2(b) );endmodule
HDLBits - GitHub 주소
·
HDLBits/Verilog
https://github.com/Zi-Yoon/HDLBits GitHub - Zi-Yoon/HDLBits: Solving HDLBitsSolving HDLBits . Contribute to Zi-Yoon/HDLBits development by creating an account on GitHub.github.com해결한 모든 문제는 GitHub에 업로드 중입니다.
HDLBits - Vector5
·
HDLBits/Verilog
주어진 5개의 1-bit 신호를 XNOR 연산을 통해주어진 그림과 같이 연산하여 25-bit의 출력으로 나타내는 문제이다.항상 코드의 범용성과 가독성을 고려해서 작성하려고 노력하는 편이다.이번에도 그렇게 짜려고 wire을 일부러 선언하여 사용했다.module top_module ( input a, b, c, d, e, output [24:0] out );// wire [4:0] w_abcde = {a, b, c, d, e}; wire [4:0] w_xnor_a = ~{5{a}} ^ w_abcde; wire [4:0] w_xnor_b = ~{5{b}} ^ w_abcde; wire [4:0] w_xnor_c = ~{5{c}} ^ w_abcde; wire [4:0] w_x..
HDLBits - Vector4
·
HDLBits/Verilog
Concatenation Operator{} 연결 연산자를 사용해서 더 큰 Vector를 형성 할 수 있다.{num{vector}} 반복되는 Vector는 앞에 숫자를 붙여서 축약 할 수 있다.예를 들어{2{a,b,c}}, {3'd5, {2{3'd6}}}와 같이 사용 가능하다.문제는 8bit 짜리 in을 부호자리를 늘려서 32bit로 표현 하라는 문제module top_module ( input [7:0] in, output [31:0] out ); assign out = {{24{in[7]}}, in[7:0]};endmodule