Wishbone SSRAM controller

베릴로그 | 2012/01/04 22:49 | Posted by DMW
크리에이티브 커먼즈 라이선스
Creative Commons License
모종의 이유로 16비트 SSRAM 컨트롤러를 만들고 있었는데 이미 매우 잘 만들어 진것이 있어서 만들다 말았다. 그 만들다 만 결과물을 올린다능. 만들다 말아서 시뮬레이션 까지만 검증이 되었다. 블로그가 말라 죽을꺼 같아서 올렸봤다. 스펙은 다음과 같다.

support 32bit Wishbone interface
support only 16bit SSRAM
support single word, half-word, byte access
does not support Wishbone burst operation

아래 코드를 내려받고 sim 디렉토리 아래로 찾아가서 make 하면 돌려볼 수 있다.



저작자 표시 비영리 동일 조건 변경 허락

'베릴로그' 카테고리의 다른 글

Wishbone SSRAM controller  (2) 2012/01/04
Clock speed  (0) 2011/05/02
Verilog VPI example  (2) 2011/03/21
Verilog Coding Guidelines  (2) 2010/12/11
베릴로그 스니펫 Resettable D flip-flop  (3) 2010/11/14
베릴로그 스니펫 D flip-flop, Verilog D flip-flop  (0) 2010/11/13

댓글을 달아 주세요

  1. prismatic 2012/01/14 03:20  댓글주소  수정/삭제  댓글쓰기

    헐 성님! ㄷㅁㅇ 성님! ㅠㅜ
    공부자료 생겼네 ㅠㅜ

크리에이티브 커먼즈 라이선스
Creative Commons License
 
module EventDispatcher
	def setup_listeners
		@listeners = {}
		@change = false
	end

	def register_listener(listener, event)
		(@listeners[event] ||= []) << listener
	end

	def remove_listener(listener, event)
		(@listeners[event] ||= []).delete listener
	end

	def remove_listeners(event)
		@listeners[event] = []
	end

	def count_listeners(event)
		(@listeners[event] ||= []).size
	end

	def changed?
		@change
	end

	protected
	def notify(event, arg)
		return if not @change
		if @listeners[event]
			callback = ("update_at_" + event.to_s).to_sym
			@listeners[event].each do |listener|
				if listener.respond_to? callback
					listener.send callback, arg
				elsif listener.respond_to? :update
					listener.update event, arg
				end
			end
		end
		@change = false
		return nil	
	end

	def changed
		@change = true
	end
end	

class TestFactory
	include EventDispatcher
	
	def initialize
		setup_listeners
	end	

	def create_button(color)
		changed
		notify(:new_button, {:color => color})
	end

	def create_label(text)
		changed
		notify(:new_label, {:text => text})
	end
end

class TestWidgetCounter
	def initialize(widget_factory)
		@counts = Hash.new(0)
		widget_factory.register_listener(self, :new_button)
		widget_factory.register_listener(self, :new_label)
	end

	def update(event, arg)
		case event
		when :new_label
			puts "#{arg[:text]} label created."
		end	
	end

	def update_at_new_button(arg)
		color = arg[:color]
		@counts[color] += 1
		puts "#{@counts[color]} #{color} button(s) created."
	end
end



f = TestFactory.new
t = TestWidgetCounter.new(f)

f.create_button("red")
f.create_button("blue")
f.create_button("green")
f.create_label("name")
f.create_button("red")

f.remove_listener(t, :new_label)
f.create_label("cellphone")

f.create_button("blue")


Output:
1
2
3
4
5
6
1 red button(s) created.
1 blue button(s) created.
1 green button(s) created.
name label created.
2 red button(s) created.
2 blue button(s) created.


APE 0.50a 포팅할 때 사용하려고 만들었던 EventDispatcher
저작자 표시 비영리 동일 조건 변경 허락

'객체지향 프로그래밍 > 디자인 페턴' 카테고리의 다른 글

ruby EventDispatcher  (0) 2011/11/06
Thread Pool  (6) 2009/04/10
Object Pool  (11) 2009/03/08
MVC(Model-View-Controller) 디자인 패턴에 대한 좋은 아티클들  (5) 2008/08/08

댓글을 달아 주세요

80000 hit

뻘글들 | 2011/09/24 14:46 | Posted by DMW
크리에이티브 커먼즈 라이선스
Creative Commons License

어느센가 8만히트가 넘었네요.

방문해주신 모든분들께 다시 한번 감사드립니다. ^^ 
저작자 표시 비영리 동일 조건 변경 허락

'뻘글들' 카테고리의 다른 글

80000 hit  (1) 2011/09/24
FreeRTOS port of OpenRISC  (2) 2011/08/01
요즘 하고 있는 것  (2) 2011/07/25
GDB Reverse debugging  (0) 2011/07/21
How to install Boost Library in Mingw  (0) 2011/05/16
집에서 쓰는 키보드, Filco Zero Tenkeyless  (1) 2010/11/07
TAG 뻘글

댓글을 달아 주세요

  1. Favicon of http://clippership.tistory.com BlogIcon LaLuna 2011/10/21 02:19  댓글주소  수정/삭제  댓글쓰기

    오메 이것이 무엇이당가?
    대단 허네요

Zsh를 써보자 #3

튜토리얼/Zsh | 2011/08/25 06:44 | Posted by DMW
크리에이티브 커먼즈 라이선스
Creative Commons License
다른 사람들 프롬프트를 보면 막 되게 화려한데....우리껀 그정도까진 아니다. 인터넷에서 스크린샷을 찾아보면 현재 디렉토리가 SCM으로 관리되고 있는 working copy라면 막 repository정보를 프롬프트에서 보여주고 그런다!

나도 하고 싶다.

일단 .zshrc 잴위에 아래 라인을 붙여넣자.

autoload -Uz vcs_info

그리고 elite2 테마를 설정했던 라인을 지워버리고 아래 코드를 젤 밑에 붙여넣자.

# DMW prompt setting
precmd() {
    psvar=()
    vcs_info
    [[ -n $vcs_info_msg_0_ ]] && psvar[1]="$vcs_info_msg_0_"
}
PS1="%d %1v "

zsh를 다시 꺼다키고 아무 디렉토리나 working copy로 가보자. 아마 아래랑 비슷한 화면을 볼 수 있을꺼라능.


물론 svn 말고 Git등등 도 된다. 이제 vcs_info를 가지고 prompt를 잘 튜닝해보면 된다. 색깔로 막 다양하게 넣고 >_<. 관련된 정보는 아래와 같은 키워드로 검색을 해보자.

'zsh vcs_info'
'zsh prompt'

나는 더 관련정보를 가지고 있지 않다. 왜냐면...zsh가 쉘창마다 명령어 히스토리랑 디렉토리 스택이 공유되는게 너무 불편해서 딱 여기까지 해보고 도루 bash로 돌아왔기 때문이다.

여러분 bash가 짱입니다.
저작자 표시 비영리 동일 조건 변경 허락

'튜토리얼 > Zsh' 카테고리의 다른 글

Zsh를 써보자 #3  (2) 2011/08/25
Zsh를 써보자 #2  (2) 2011/08/05
Zsh를 써보자 #1  (0) 2011/08/05
TAG Zsh

댓글을 달아 주세요

  1. Sean 2011/09/09 07:55  댓글주소  수정/삭제  댓글쓰기

    끵..?

Zsh를 써보자 #2

튜토리얼/Zsh | 2011/08/05 20:56 | Posted by DMW
크리에이티브 커먼즈 라이선스
Creative Commons License
2. 둘째날
Zsh를 깔긴 깔았는데 이건뭐...화면이 별로 엣지가 없다. 색깔고 그냥 단색이고...아무튼 이상하다. .zshrc를 고쳐야 될것 같다. 일단 아래처럼 고치자.

$ vim ~/.zshrc

autoload -U compinit promptinit

compinit
promptinit

prompt walters

마지막줄이 walters라는 프롬프트로 설정해주는 줄이다. Zsh는 프롬프트 모양에 이름을 줘서 저장할 수 있다. 테마라고 하는데 기본적으로 몇개가 깔려있다. 아래처럼 입력하면 리스트를 볼 수 있다. -h 옵션을 주면 help가 나오니 나머지는 알아서 하자.

$ prompt -l

맘에 드는걸로 바꺼보고 몇가지 alias 를 추가해서 .zshrc를 고쳐보자. Key binding 그딴거는 엣지랑 별관계없으니...신경끄자.

autoload -U compinit promptinit

compinit
promptinit

prompt elite2 red

# alias setting
alias du='du -h'
alias df='df -h'
alias less='less -r'
alias ls='ls -hF --color=tty'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias vi='vim '
alias vin='vim '

이정도로 설정하면 아래같은 화면이 나온다. 오...뭔가 있어보인다.


저작자 표시 비영리 동일 조건 변경 허락

'튜토리얼 > Zsh' 카테고리의 다른 글

Zsh를 써보자 #3  (2) 2011/08/25
Zsh를 써보자 #2  (2) 2011/08/05
Zsh를 써보자 #1  (0) 2011/08/05
TAG Zsh

댓글을 달아 주세요

  1. sloth 2011/08/05 22:40  댓글주소  수정/삭제  댓글쓰기

    우분투 11.x대로 들어가면서 걍 빨갱이 모자네껄로 갈아탔다능. bash가 더 짱이라능 하앍