Entry
  version
install
    make
    make install
  Cygwin
  Hello World
  NetBSD
    2.2.0
    2.0.1
  Emacs mode
examples
  fft/fft_fxpt
  gdb/bt
書き方
  sc_clock
  Makefile
    one module
    階層配置
    SC_THREAD
    SC_METHOD
    指定方法
    違い
  bit-slice
URL

eda

SystemC

Last Update: "2006/03/14 17:55:02 makoto"

bit-slice

// -*- SystemC -*-
// Last Update: "2006/02/26 13:57:09 makoto"
// $Id: 30400.bit-slicing.html.ja,v 1.1.1.1 2008/03/12 10:46:51 makoto Exp $
#include <systemc.h>

////////////////////////////////////////////
SC_MODULE(bit_range)
{
	sc_in clock_in;
	void bit_range::sample();

	SC_CTOR(bit_range) {
		SC_METHOD(sample);
		sensitive << clock_in.pos();
	};
};

void bit_range::sample(void)
{
	sc_uint<32> hoge;
	// assign some bits to the variable
	hoge.range(1,0 )  = 1;
	hoge.range(15,8)  = 1;
	hoge.range(31,30) = 3;

	cout << hoge << " ";
	printf("%04x\n", (int) hoge);
};

//////////////////////////////////////////
int sc_main(int argc, char **argv)
{
	sc_trace_file *trace_file;
	sc_clock clkone ("clock", 2);

	trace_file = sc_create_vcd_trace_file("clock-trace");

	bit_range *boxptr;

	boxptr = new bit_range("bit_range");
	boxptr -> clock_in(clkone);

	sc_trace(trace_file, clkone, "clock");

	sc_start(3, SC_NS);
	return (1);
};
execution
ttyq4:makoto@lets  17:32:01/060314(...pr/one)>./run.x

             SystemC 2.0.1 --- Feb 26 2006 11:04:18
        Copyright (c) 1996-2002 by all Contributors
                    ALL RIGHTS RESERVED
3221225729 c0000101
3221225729 c0000101
WARNING: Default time step is used for VCD tracing.
3221225729 c0000101
ttyq4:makoto@lets  17:33:01/060314(...pr/one)> 
Last Update: Wed, 09 Dec 2009 21:49:30 GMT 1.1.1.1 2008/03/12