Jump to content

connect 12 bit to 16 bit


mahbod72

Recommended Posts

Hi

I want to design basic computer with systemc and I faced a problem in my code.

The common bus of yhe basic computer is 16 bit and the address register is 12 bit. When i instantiate address register i don’t know how to connect 12 bit to 16 bit. 

AR = new reg12bit ("AR");
(*AR) (inc_ar,ld_ar,clr_ar,bus,ar2buf,clk); 

in the above Piece code the output of my register is 12 bit and the bus is 16 bit.

my idea is i use .range() but .range() just used for variables not ports or signals.

please help me.

 
Link to post
Share on other sites

The simplest way is to write a process (SC_METHOD) to copy the values across, e.g.

SC_METHOD(copier);
sensitive << bus;

void copier() {
    myreg = bus.read().range(11,0);
}

Alternatively have a look at the sc_vector introduced in the SystemC 1666-2011 standard, which was introduced to solve this kind of problem,

 

regards

Alan

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...