首页 > 解决方案 > 无法理解 systemc '<<' 操作

问题描述

我正在查看 systemc 库(特别是“示例”文件夹)中的“risc-cpu”代码,但我不明白 main.cpp 中的 << 操作是什么。在 main.cpp 他们实例化每个模块并使用许多 sc_signal 变量执行 << 操作。我认为这类似于绑定操作,但我想确切地知道。

下面是来自 main.cpp 的一些代码

fetch   IFU("FETCH_BLOCK");      //instiate module fetch
    IFU.init_param(delay_cycles);  //module fetch delay for delay_cycles
    IFU << ram_dataout << branch_target_address << next_pc << branch_valid
        << stall_fetch << intreq << vectno << bios_valid << icache_valid
        << pred_fetch << pred_branch_address << pred_branch_valid << ram_cs << ram_we
        << addr << ram_datain << instruction << instruction_valid << program_counter
        << intack_cpu << branch_clear << pred_fetch_valid << reset << clk;

decode  IDU("DECODE_BLOCK");   //instanciate module decode as IDU
    IDU << reset << instruction << pred_instruction << instruction_valid
        << pred_inst_valid << out_valid << destout << dout << dram_dataout
        << dram_rd_valid << destout << fdout << fout_valid << fdestout
        << branch_clear << dsp_data_valid << program_counter << pred_on
        << branch_instruction_address << next_pc << branch_valid
        << branch_target_address << mem_access << mem_address << alu_op
        << mem_write << alu_src << reg_write << src_A << src_B << forward_A
        << forward_B << stall_fetch << decode_valid << float_valid << mmx_valid
        << pid_valid << pid_data << clk;

标签: operator-keywordsystemc

解决方案


<<是标准的左移运算符,它在 C++ 中被重载,也可用作放入流。在我看来,他们只是向IFUand写入了很多值IDU


推荐阅读